apache / apache/jmeter

JMS (P2P) and JMS Subscriber not working properly with Throughput Controller in a Test script

Open
#4,738 0 comments 0 reactions 0 assignees View on GitHub
os: All P2
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

**vishalendu** ([Bug 62256](https://bz.apache.org/bugzilla//show_bug.cgi?id=62256&redirect=false)):
I am doing an automation where
1) A script (Producer) will call some API and put the output on a JMS Queue. It would end after that.
2) Another script (Consumer) will pick these messages and execute them.

I had some issue with the second script. (Which almost took a day to figure out.)
Script look something like this:

Read From JMS (JMS P2P) (Tried this with JMS Subscriber as well)
If (Message not empty)
Throughput Controller 1 (50%)
: Do some work
Throughput Controller 2 (50%)
: Do some work

Even though, I was running the above script with a single thread and 2 iterations, I could see in the Result Tree Listener that the "JMS P2P" sampler was getting called 2 times in the begining, instead of being called sequentially. This was confusing and frustrating, since I was running 1 thread.

FYI, there is a configuration on the JMS P2P/JMS Subscriber samplers "Number of Samples to aggregate". This was set to 1 all along.

Since the JMS P2P was getting called in the beginning 2 times, both the Throughput Controllers were getting the last JMS message. Due to this, one of the Transaction passed and the other failed.

I had to resort to the following solution:

Read From JMS (JMS P2P)
If (Message not empty)
Random Controller1
: Simple Controller1
: Do some work
Random Controller2
: Simple Controller2
: Do some work

I am attaching a script that I used to do a POC for this issue. You will have to add activemq jars to your lib/ext for the ActiveMQ JMS P2P to work. Create a test queue named TestQueue and put the following messages:

{"txnId":"1"}
and
{"txnId":"2"}

When you run the attached test script, the JSR223 Sampler1/2 will both print the txnId as 2. Even though there is only 1 thread and 2 iterations.

Created attachment [JMS-ThroughputCont-issue-simulation.jmx](https://apache.github.io/jmeter-bugzilla-attachments/56/62256/35838/JMS-ThroughputCont-issue-simulation.jmx): JMeter script for the POC of issue

Severity: normal
OS: All

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.