Search code examples
jmeterjmsactivemq-artemispoint-to-point

Valid value usage in JMeter's JMS Subscriber 'JMS Selector' property - in order to consume messages with a dynamically changing JMSCorrelationID


I have an Apache ActiveMQ Artemis server hosting some queues. With the help of JMeter JMS Publisher sampler I am publishing a set of messages with some specific property1 and valueX on a queue1 and an app is providing me with response messages to those specific request messages on another queue2 having valueX in the JMSCorrelationId property of the JMS message header. I consume the response message using a JMS Subscriber sampler.

If I just consume the messages'blindly' without using a JMS Selector in the JMS Subscriber sampler I can see in the view results tree (Response Data -> Response Headers) that the consumed messages have the following example property and value:

JMSCorrelationId 20240315165957905

What I need is to only consume messages with a specific value (which comes from a JMeter variable) in the JMSCorrelationId property from the message header.

I don't understand what value I need to set in the JMS Subscriber property in order to only consume messages having a specific JMSCorrelationId in their header.

I have tried using this in the JMS Selector property of the sampler.

JMSCorrelationID = '${uniqueID}'

or

JMSCorrelationID = 'ID:${uniqueID}'

and for some reason the JMS Subscriber sampler is not able to find the message even though I see it is in the queue (using the ActiveMQ Artemis Management Console).

Also, I don't know how to debug what static value is used in the selector value by this JMS subscriber sampler because I can't see it generating any logs in the JMeter log file.

Any kind of insight would be much appreciated.


Solution

  • Try choosing Each sample box under "Setup" in the JMS Subscriber:

    enter image description here

    The values of JMeter variables can be observed in jmeter.log file if you increase JMeter logging verbosity to debug level.

    You can also download or checkout JMeter source code, open the project in your favourite IDE, set the breakpoint in JMSSampler.browseQueueForConsumption() function and see the actual JMS Selector value.