On 04/21/2010 08:08 PM, Clive Lilley wrote:
Clive Lilley wrote:
Gordon Sim wrote:
On 04/19/2010 07:53 PM, Clive Lilley wrote:
Hello,
I have been using the QPID C++ broker and C++ client API for the last
several weeks and I have come across an issue today that I thought I
had
better raise.
I have been using MessageListeners to receive messages in my C++ client
applications, something like
/Connection conn = Connection(host,port);
Session session = conn.newSession();
SubscriptionManager subMgmt = SubscriptionManager(session);
subMgmt.subscribe(MyMsgListener1, myQueue1Name);
subMgmt.subscriber(MyMsgListener2, myQueue2Name);
subMgmt.run();/
And everything works as expected. But if I try to use LocalQueues I
don't get the behaviour I would have expected. If I change the above
code to
/ Connection conn = Connection(host,port);
Session session = conn.newSession();
SubscriptionManager subMgmt = SubscriptionManager(session);
subMgmt.subscribe(MyLocalQueue1, myQueue1Name);
subMgmt.subscribe(MyLocalQueue2, myQueue2Name);
subMgmt.run();
/My application only reads messages off /MyLocalQueue2, /even though
the
queue, myQueue1Name, in the broker is filling up with messages. If I
comment out the MyLocalQueue2 subscribe line then I can read messages
from MyLocalQueue1.
So it seems that a SubscriptionManager can only be configured with a
single LocalQueue. If I change my code to the following
/ Connection conn = Connection(host,port);
Session session = conn.newSession();
SubscriptionManager subMgmt1 = SubscriptionManager(session);
// SubscriptionManager subMgmt2 = SubscriptionManager(session);/
/ subMgmt1.subscribe(MyLocalQueue1, myQueue1Name);
subMgmt2.subscribe(MyLocalQueue2, myQueue2Name);
subMgmt1.run();
// subMgmt2.run();/
then everything works fine. Is this the expected behaviour?
No, that is not expected. I tried a little example of my own that
*does* receive messages from two separate LocalQueues (see attached).
What version of the code are you using, and does the attached test
work for you (create queue-1, queue-2, run the test then send some
messages to those queues)?
If this does work for you, what are the key differences between your
case and this test app? Are you using separate threads to process
each LocalQueue?
------------------------------------------------------------------------
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]
I am using qpid-0.6 on rhel5u4. I have run your example code at home
on centOS 5.4 and it works exactly as I would have expected. I will
check my non-working code example when I get to work tomorrow. I have
tried modifying your code to reflect what I believe I have at work but
I cannot get it to fail (which is both good and bad!!). Will hopefully
be able to give you full details tomorrow after work.
regards
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]
I have replaced by code at work to run with multiple queues using a
single subscription manager and it all works fine. Not to sure what I
did wrong but thanks for the help and sorry if I have wasted your time.
Not at all. Glad you got it working!
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]