Re: strange behavior using proton-j Messenger with activemq for request/reply test

2014-10-03 Thread Gordon Sim

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.




Re: strange behavior using proton-j Messenger with activemq for request/reply test

2014-10-03 Thread Martin, Jimmy
Thanks, Gordon. This seems to be the likely cause of the problem.

The Messenger API doesn¹t seem to allow you to specify how connections are
made or managed. Perhaps this is the root of my problem. I can understand
how ActiveMQ being JMS-centric would assume that all the sessions for an
application instance are multiplexed over a single connection. Does the
Messenger code then assume that every address should map to a unique
connection? If so, it means I cannot connect directly to ActiveMQ when the
application uses more than one destination on a broker.

Would this scenario work if the application communicates to ActiveMQ via a
dispatch router? Is it possible to configure the router to have multiple
application connections and a single connection between the router and the
broker?

-Jimmy

On 10/3/14, 3:44 AM, Gordon Sim g...@redhat.com wrote:

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.




strange behavior using proton-j Messenger with activemq for request/reply test

2014-10-02 Thread Martin, Jimmy
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}}
- 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.

Thanks,
Jimmy