On 11/29/2012 01:47 AM, Adam Zedan wrote:
> I am trying to understand batch fetching with the following practical
> example.Currently My Qpid Broker has 70 items in it. I am trying to
> implement batch fetching however I am not having any success. Here is what
> I am doing in C# receiver.
>
> Receiver rx = session.CreateReceiver("QueueA");
> rx.Capacity = 20000 ;
> while (rx.Fetch(ref message_n, timeout_n))
> {
> uint val = rx.Available; //Value is 69. So does this mean
> only 1 item was fetched ?
> //Some code to process the message
> session.Acknowledge();
> }
>
> As it can be seen that only one item was fetched reducing the content from
> 70 to 69 in the broker. I thought with batch fetching you could retrieve
> all the 70 items at one time since my count is set to 20000. Am i missing
> something here ?
The fetch call returns at most one message. The way prefetch works is by
allowing the broker to send messages to the client that the client
library will hold in anticipation of further fetch calls.
In your case, if available is reporting 70 messages, then the next 70
calls to fetch are just returning messages from a local, client side
buffer. There is no round trip involved. (Of course were there any more
messages on the broker those could be sent at any time providing the
client had capacity).
In other words the prefetch is not so much a batch interface as a way to
prevent having to do a network round-trip per fetch.
> Any suggestions would help. Also how do I acknowledge
> batch messages.
Just call its less frequently then every message. The acknowledge call
without parameters will acknowledge all previously fetched messages.
> I want to reduce network load by making minimum trip to the
> broker that is why I am trying to use batch fetching (prefetch)
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
|