Azure Service Bus - PeekBatchAsync returns fewer messages than expected

In the Azure Service Bus topic I have a subscription with over 1000 posts. These messages are consumed by the work role. For monitoring purposes, I want to look at the first 10 messages to see which messages are waiting to be processed. To complete this task, I create a client account and I call the PeekBatchAsync method. The strange behavior is that sometimes PeekBatchAsync returns less than 10 messages (i.e. 2 or 4 messages).

Code example:

Dim subscriptionClient As SubscriptionClient = messagingFactory.CreateSubscriptionClient(topicName, subscriptionName)
Dim messages = Await subscriptionClient.PeekBatchAsync(10)

Additional context clarification information:

  • I am sure that the subscription contains more than 1000 messages
  • The theme was created using EnablePartitioning = True
  • I am using the Microsoft.ServiceBus v library. 2.3.4.0
  • I use sessions
  • (10), . , .

: , ?

+1
1

, Azure-ServiceBus ReceiveBatch -method PeekBatchAsync. : . ( 10) , .

: (int messageCount, TimeSpan serverWaitTime), .

+1

Source: https://habr.com/ru/post/1675819/


All Articles