You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Andrew L <kh...@hotmail.com> on 2010/02/03 22:56:29 UTC

Leave (peek) message on queue

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/

Does queuePurge send to the alternate exchange?

Posted by Andrew L <kh...@hotmail.com>.
When I purge a queue (it is exclusive, auto-delete), the messages are not sent to the alternate exchange specified for the queue.  

Is this the anticipated functionality?  Or should those messages be sent to the alternate exchange?

Thanks.
 		 	   		  
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/201469229/direct/01/

Re: Leave (peek) message on queue

Posted by Alan Conway <ac...@redhat.com>.
On 02/03/2010 05:16 PM, Andrew L wrote:
>
> 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.
>
>

That's correct - I'll update the API comment to make this more clear, I can see 
why you were misled.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


RE: Leave (peek) message on queue

Posted by Andrew L <kh...@hotmail.com>.
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: khayman218@hotmail.com
> To: users@qpid.apache.org
> 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/