qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Borkowski <rborkow...@ideeli.com>
Subject Re: c++ broker, ruby client, and prefetch
Date Fri, 11 Dec 2009 16:33:43 GMT
Thanks! That works like I want it to now

On Fri, Dec 11, 2009 at 7:50 AM, Gordon Sim <gsim@redhat.com> wrote:

> On 12/10/2009 08:18 PM, Robert Borkowski wrote:
>
>> Hello,
>>
>> Would anyone have pointers on how to get the ruby client to pull a single
>> message off a queue with no prefetch?
>> If I have a queue with many items in it and I start connecting a few
>> competing consumers, I'd like to prevent the first client from prefetching
>> 5000 items...
>>
>
> You can use the message_flow command to set the credit (this is done by the
> start() method on your incoming queue in the hello world example, and there
> it is set to infinite credit). You can also then issue a message_flush,
> which when it returns (in synchronous operation) implies that any message
> that was on the queue has been delivered to you.
>
> E.g. something like
>
> ssn.message_subscribe(:destination => "d", :queue => "test-queue")
> incoming = ssn.incoming("d")
> ssn.message_set_flow_mode("d", ssn.message_flow_mode.credit)
> ssn.message_flow("d", ssn.message_credit_unit.message, 1)
> ssn.message_flow("d", ssn.message_credit_unit.byte, 0xFFFFFFFF)
> ssn.message_flush("d")
> p incoming.get()
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>
That works, thanks!

-- 
Robert Borkowski

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message