I commented out a bunch of stuff, and the second part works now:

    SubscriptionManager subscriptions(session);
// Create a listener and subscribe it to the queue named "message_queue"
    Listener listener(subscriptions);
    // Receive messages until the subscription is cancelled
    // by Listener::received()
    LocalQueue lq;
    //     subscriptions.start();
    //     subscriptions.setAutoStop(false);
    SubscriptionSettings settings;
    //     settings.completionMode = COMPLETE_ON_ACCEPT;
    //     settings.acceptMode = ACCEPT_MODE_EXPLICIT;
    //     settings.autoAck = 0;
    //     settings.flowControl = FlowControl::unlimited();

// Subscription sub1 = subscriptions.subscribe(lq, "message_queue", settings, "lq");
    //          Message m = lq.pop();
    //          sub1.cancel();

         subscriptions.subscribe(listener, "message_queue", "listener");
         subscriptions.run();

Honestly, I still don't see where the problem is. Still uncommenting and investigating.

Jonathan


Carl Trieloff wrote:

Sorry, one more question, are you M4 or trunk, as Gordon had corrected something in
this area a little while after M4.

Still thinking but the cancel after the start. might need another start(?). I work more on the broker
so will need to go look at that code.

Carl.


Adam Chase wrote:
That is correct.

I published 100 messages to the queue, got one off the localQueue and
then cancelled.  Since I didn't accept the one I would expect to get
100 from the listener.  But I'm getting none.  I think the LocalQueue
must have prefetched them and be holding on to them.  I thought maybe
the cancel would release them, but maybe I have to kill the session or
something.  Not totally sure.

Thanks,

Adam

On Wed, Jan 28, 2009 at 9:07 AM, Carl Trieloff <[email protected]> wrote:
Adam Chase wrote:


When I do this I get no messages on my listener and subscriptions just
exits.  If I do a while(sleep) instead of the wait, I still never see
my message.  Even if I make 2 connections and 2 sessions and 2
subscriptionManagers and run them both I still don't see messages on
the listener.

Am I doing something wrong?


one brief clarification, you are not getting any messages when you
re-subscribe. I.e you
get messages on the lq, but not on the listener?

Carl.

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




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



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

Reply via email to