You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Darryl L. Pierce" <dp...@redhat.com> on 2011/06/24 21:40:40 UTC

Setting up so that a session blocks on sync...

So in IRC I asked this question and Gordon suggested the following,
which I followed:

1. Create a new queue:
  a. I have the test generated a purely random name.
  b. I create the queue using:
    abcde;{create:always,node:{x-declare:{arguments:{'qpid.max_count':10}}}}

2. Create a sender.

3. Send 10 messages to the queue.
  a. I accidentally sent 11 initially and blew it up, so the queue is
     definitely only allowed 10 messages.
  b. The last message is simply "DONE"

4. Call Session.sync :block => true
  a. This call is immediately returning.

5. Create a receiver.

6. Receive the messages.
  a. Exit when "DONE" is received.

The odd thing is, as I mention in 4a above, the call to session.sync
should block (as I understand it) until at least two messages are popped
out of the queue since it's at full capacity when I send the 10 messages
initially.

So why does this exist immediately? Is there some better way to fill the
queue and force Session.sync to block indefinitely?

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/


Re: Setting up so that a session blocks on sync...

Posted by Ken Giusti <kg...@redhat.com>.
FYI: worked this through with Darryl on IRC.  The broker was configured with flow control disabled by default.

Specifically configuring flow control on the queue and setting the sender's capacity to 10 caused the sync() to block as expected....

Later,


-K

----- Original Message -----
> So in IRC I asked this question and Gordon suggested the following,
> which I followed:
> 
> 1. Create a new queue:
> a. I have the test generated a purely random name.
> b. I create the queue using:
> abcde;{create:always,node:{x-declare:{arguments:{'qpid.max_count':10}}}}
> 
> 2. Create a sender.
> 
> 3. Send 10 messages to the queue.
> a. I accidentally sent 11 initially and blew it up, so the queue is
> definitely only allowed 10 messages.
> b. The last message is simply "DONE"
> 
> 4. Call Session.sync :block => true
> a. This call is immediately returning.
> 
> 5. Create a receiver.
> 
> 6. Receive the messages.
> a. Exit when "DONE" is received.
> 
> The odd thing is, as I mention in 4a above, the call to session.sync
> should block (as I understand it) until at least two messages are
> popped
> out of the queue since it's at full capacity when I send the 10
> messages
> initially.
> 
> So why does this exist immediately? Is there some better way to fill
> the
> queue and force Session.sync to block indefinitely?
> 
> --
> Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
> Delivering value year after year.
> Red Hat ranks #1 in value among software vendors.
> http://www.redhat.com/promo/vendor/

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