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? If it is then perhaps the SubscriptionManager should throw an exception if an attempt is made to subscribe to a second LocalQueue.

Having looked at the SubscriptionManager implementation I see that MessageListener's get registered into a Dispatcher while LocalQueue's have their queue implementation set to that of the session (via SubscriptionImpl::divert()).

Regards


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to