On 10/02/2014 10:39 PM, Martin, Jimmy wrote:
I wrote a couple of simple java apps using Messenger to demonstrate
request/reply operation. Each app instantiates a single instance of Messenger
to send and receive messages from the queues.
Run Reply app:
1) subscribe to request queue and call recv() to wait for the request
message
2) on receipt of request message send reply message to destination
specified by reply-to field of the request
Run Request app:
1) subscribe to the reply queue
2) send a message to the request queue
3) call Messenger.recv() to wait for the reply
Pretty simple. And it works pretty reliably if I use a QPID broker to
intermediate between request and reply. If I use ActiveMQ (I’ve tried 5.10 and
5.11-SNAPSHOT) I typically see the following:
- the reply app connects to activemq and is waiting for the request message
- the request app sends the message, no exception thrown but see this message
in the log:
FINE: IN: CH[0] : Close{error=Error{condition=amqp:invalid-field,
description='Broker: localhost - Client: request already connected from
tcp://127.0.0.1:50485', info=null}}
This sounds like it might be
https://issues.apache.org/jira/browse/AMQ-4590: ActiveMQ only allows one
connection with a given container identifier at present.
ActiveMQ uses the container identifier as the JMS client id for e.g.
durable subscriptions, and accordingly allows only one active connection
with a given client id at any time.
So if the request app is trying to establish two separate connections
(one for the subscription and one for the send) that would cause the
issue. There maybe some way to force it to use just one connection, but
I am not familiar enough with that client to say for sure.
- no request message is seen by the broker and the request app is not connected
- the request app calls Messenger.recv() which returns right away.
Messenger.incoming() returns 0.
If I kill the reply app and and run the request app, I do see the request
message in activemq queue.
I have used proton-j versions 0.7, 0.8 and 1.0-SNAPSHOT and all seem to exhibit
the same behavior.
Any hints on what I’m doing wrong would be appreciated.