On Mon, Jan 09, 2012 at 09:40:55AM +0000, Gordon Sim wrote:
> On 01/06/2012 10:58 PM, William Henry wrote:
> >
> >I'm curious about the following:
> >
> >1) Why do you need to explicitly set the receiver capacity in order to 
> >receiver messages? You'd think that be default you'd not have to set this.
> 
> You don't. The capacity controls the number of 'prefetched' messages
> the library will accept, i.e. messages delivered by the broker
> before - and in anticipation of - application calls to fetch().
> 
> The default is to have no prefetch, which means the broker will only
> deliver a message in response to an explicit fetch() call. The
> reason for this default is that it gives the most intuitive
> behaviour in many cases and so is good for exploring/experimenting.
> (Messages aren't hidden in prefetch queues anywhere).

One language-specific difference is that, with the non-blocking I/O
extension for Ruby, the default capacity on a Receiver is 1 rather than
0.

> However, if you are using next_receiver() to service several
> receivers, then you do need messages to be delivered before you call
> fetch() (since you don't know which of them will have messages) and
> so in that case you do need to set capacity to some value greater
> than zero.

-- 
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/

Attachment: pgpKLH7YkCTOm.pgp
Description: PGP signature

Reply via email to