Changing the code to this obtained the desired result:

    SubscriptionManager idSubscription(session);
    Message m;

    LocalQueue lq;
    qpid::sys::Duration duration(1000000000);

    std::string queue("queue");
    std::string unique = qpid::framing::Uuid(true).str();
    idSubscription.subscribe(lq, queue, 
SubscriptionSettings(FlowControl::messageCredit(1), 
qpid::framing::message::ACCEPT_MODE_NONE, 
qpid::framing::message::ACQUIRE_MODE_NOT_ACQUIRED, 0), unique);
    lq.get(m, duration);


It appears that SubscriptionManager::get uses a separate SubscriptionSettings 
and thus was not honoring the previous calls to configure the settings from the 
SubscriptionManager::setAccetMode, etc.


> From: [email protected]
> To: [email protected]
> Subject: Leave (peek) message on queue
> Date: Wed, 3 Feb 2010 16:56:29 -0500
> 
> 
> I am trying to just peek at a message on the queue.  I do not want to acquire 
> or accept it.  I have tried the following code:
> 
> 
>     SubscriptionManager idSubscription(session);
>     Message m;
>     idSubscription.setAcceptMode(qpid::framing::message::ACCEPT_MODE_NONE);
>     
> idSubscription.setAcquireMode(qpid::framing::message::ACQUIRE_MODE_NOT_ACQUIRED);
>     idSubscription.get(m, "queue");
> 
> I thought I had set the modes correctly (I also tried the 
> ACCEPT_MODE_EXPLICIT), but the message is always dequeued.  Do I need to 
> release the message?  Or configure the peek differently?
> 
> Thanks.
>                                         
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
> http://clk.atdmt.com/GBL/go/201469226/direct/01/
                                          
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/201469229/direct/01/

Reply via email to