Reputation: 129
Working Scenario:
Not Working:
Read Msgs.. Actual: I read only Msg2 Expectation: Want to read Msg1, Msg2.
if (namespaceManager.TopicExists(topic))
{
var lstOfValues = new List<SITConfirmation>();
SubscriptionClient Client = SubscriptionClient.CreateFromConnectionString(ConfigurationManager.ConectionString(), topic, subscriber);
IEnumerable<BrokeredMessage> messages = await Client.ReceiveBatchAsync(10, TimeSpan.FromMilliseconds(500));
}
Upvotes: 0
Views: 350
Reputation: 25994
With ReceiveBatchAsync(messageCount)
you're not promised to get the exact number of messages requested. Gateway could have all the messages or not. It will return whatever it has (gateway might have less/more/same number of messages that are actually stored on the broker entity).
From the documentation:
As this is an approximation, fewer or more messages than messageCount may be returned.
Upvotes: 1