0
votes

Has any one succeeded in using JMeter Random variable in JMS Selector with JMeter JMS Subscriber for ActiveMQ.

So far I tried to use like below for Random variables but no luck.

JMSCorrelationID ='${msgCorrelation_ID}'

Above selector is working if msgCorrelation_ID is defined as UDV but I need to use Random values per threads.

2

2 Answers

2
votes

How do you set your msgCorrelation_ID? What value does Debug Sampler report?

As a solution I can suggest straightforward way of explicit generation of msgCorrelation_ID variable.

Add a Beanshell Pre Processor to your request configured as follows:

Parameters: ${__RandomString(10,abcdefghijklmnopqrstuvwxyz0123456789,)}

Script: vars.put("msgCorrelation_ID", Parameters);

This will populate msgCorrelation_ID variable with random alphanumeric string of 10 characters. You will be able to refer to it where required as ${msgCorrelation_ID} or ${__V(msgCorrelation_ID)}

References:

1
votes

This is because UDV are initialized at test plan startup. Since you have created your variable in Processor, you need to check Setup: Each sample on JMS Subscriber screen, so connection is initialized after ${msgCorrelation_ID} initialization.

Dynamic JMeter JMSSelector

Dynamic JMeter JMSSelector each sample