Bug 62256 - JMS (P2P) and JMS Subscriber not working properly with Throughput Controller in a Test script
Summary: JMS (P2P) and JMS Subscriber not working properly with Throughput Controller ...
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 4.0
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-04 13:15 UTC by vishalendu
Modified: 2018-04-04 13:15 UTC (History)
0 users



Attachments
JMeter script for the POC of issue (10.20 KB, application/xml)
2018-04-04 13:15 UTC, vishalendu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vishalendu 2018-04-04 13:15:10 UTC
Created attachment 35838 [details]
JMeter script for the POC of issue

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.