Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Microsoft.ServiceBus.Messaging.QueueClient ReceiveBatchAsync?

$
0
0

This method would seem to be useful for reading multiple message from a queue but I've yet to get more than one.

var messages = await client.ReceiveBatchAsync(50);
await client.CompleteBatchAsync(messages.Select(m => m.LockToken).ToArray());

Where client is a QueueClient. I've tried this using both ReceiveMode settings on the client (i.e. PeekLock and ReceiveAndDelete) and I consistently get only a single message back. I'd like to read all currently available messages from the queue in one pass and without something like a ReceiveBatchAsync then I'd have to await client.ReceiveAsync inside a loop until a null message was returned.


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>