Bug 44144 - JMS point-to-point: request response test does not work
Summary: JMS point-to-point: request response test does not work
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.3.1
Hardware: Other Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2007-12-27 03:47 UTC by Paul Woolley
Modified: 2016-05-18 13:44 UTC (History)
1 user (show)

Proposed fix (3.14 KB, text/plain)
2007-12-27 03:55 UTC, Paul Woolley
Proposed fix (2.68 KB, patch)
2007-12-27 06:43 UTC, Paul Woolley
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.