Bug 44144

Summary: JMS point-to-point: request response test does not work
Product: JMeter - Now in Github Reporter: Paul Woolley <pwoolley>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: major CC: chennupatiharikrishna
Priority: P2    
Version: 2.3.1   
Target Milestone: ---   
Hardware: Other   
OS: Windows XP   
Attachments: Proposed fix
Proposed fix

Description Paul Woolley 2007-12-27 03:47:13 UTC
Hi. I've been trying to use the JMS point-to-point sampler to execute a simple
request-response test, but without success. I downloaded the source and debugged
org.apache.jmeter.protocol.jms.sampler.FixedQueueExecutor and
org.apache.jmeter.protocol.jms.sampler.Receiver. The problem appears to be that
when the message is published by the FixedQueueExecutor, it is keyed in the
MessageAdmin object with its JMSMessageID (see
FixedQueueExecutor.sendAndReceive(Message request) at line 65/66), but when the
Receiver consumers the reply, it looks in MessageAdmin keyed  on
JMSCorrelationID (see Receiver.run() at line 78).  It never ties the request and
response together and the test will only ever report failures.
Comment 1 Paul Woolley 2007-12-27 03:55:59 UTC
Created attachment 21322 [details]
Proposed fix

Have attached a proposed fix for this bug.
Comment 2 Paul Woolley 2007-12-27 06:41:03 UTC
Actually, after a bit more investigation, I think keying on JMSCorrelationID
would be a better idea for the FixedQueueExecutor and the Receiver.

Although, in principle, keying on JMSMessageID should be ok, I've been running
some tests with ActiveMQ 4.1.1 and I can see that whenever ActiveMQ sends a
message, it sets a new JMSMessageID, even if you've written a
MessagePostProcessor to reset/preserve the message id.

The situation I am seeing fail is:
a) JMeter sends a message to queue A with message id 1
b) My code reads message id 1 from queue A, does some processing and compiles a
brand new message.
c) My code puts the new message on queue B, and a MessagePostProcessor attempts
to set the JMSMessageID to 1.
d) ActiveMQ goes ahead and assigns a new message id just before sending.
e) JMeter reads from queue B. Its expects message id 1, but thanks to ActiveMQ,
it finds message id ?. Failure!

A quick retry with a recompiled FixedQueueExecutor and Receiver that key on
JMSCorrelationID succeeds if I re-run the above test.  This makes more sense as
section 3.4.5 of the JMS 1.1 spec states: "A client can use the JMSCorrelationID
header field to link one message with another. A typical use is to link a
response message with its request message."

With this in mind, I think the proposed fix should be to change
org.apache.jmeter.protocol.jms.sampler.FixedQueueExecutor to key the sent
message in to the MessageAdmin object using JMSCorrelationID.
Comment 3 Paul Woolley 2007-12-27 06:43:51 UTC
Created attachment 21323 [details]
Proposed fix

Proposed fix
Comment 4 Sebb 2008-01-09 09:41:31 UTC
Thanks for the patch; applied in SVN r610480.

In future, please provide patches in unified diff format, rather than entire 
source files, as that makes the patches easier to review.
Comment 5 The ASF infrastructure team 2022-09-24 20:37:40 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2058