Created 2 samplers: JMS publisher and JMS Subscriber JMS Publisher send msgs on one queue and JMS subscriber listens msgs on another topic. How can I link these msgs to show latency??
AUT is multithreaded and order is not guaranteed on Topic.
You could save message ID or another unique message attribute into a JMeter Variable in the JMS Publisher along with the current timestamp
Whenever the message arrives to the JMS Subscriber you can check the attribute from the step 1 and obtain the timestamp at the time of sending. Then you can subtract the timestamp2 from the timestamp1 and the resulting value would be the "latency" you're looking for.
JMeter Functions you might be interested in:
You can also consider using sample_variables property to store the calculated delta value into .jtl result file and eventually plot it at the reporting dashboard