Bigsby
Bigsby

Reputation: 952

How do I completely drain a Topic Subscription?

I have roughly 1,400 messages in a Topic Subscription. When I go to do a batch receive, such as with Service Bus Explorer, of, say, 500 messages. I don't get nearly that many back. Here is a clip of the console from SBE.

<12:09:45> The subscription billingpackage for the checkoutsubmitted topic has been successfully retrieved.
<12:09:46> [36] messages received from the subscription [billingpackage].
<12:10:28> The subscription billingpackage for the checkoutsubmitted topic has been successfully retrieved.
<12:10:28> [120] messages received from the subscription [billingpackage].
<12:11:59> The subscription billingpackage for the checkoutsubmitted topic has been successfully retrieved.
<12:11:59> [40] messages received from the subscription [billingpackage].
<12:13:14> The subscription billingpackage for the checkoutsubmitted topic has been successfully retrieved.
<12:13:15> [66] messages received from the subscription [billingpackage].
<12:14:12> The subscription billingpackage for the checkoutsubmitted topic has been successfully retrieved.
<12:14:12> [140] messages received from the subscription [billingpackage].

Why am I not getting the 500 I'm asking for? I'm on Standard tier, if that matters.

Upvotes: 0

Views: 124

Answers (1)

Vijay
Vijay

Reputation: 66

That is expected. The number you specify in a batch receive is only the maximum number of messages to be retrieved in a batch. Actual number of messages received could be anywhere between 1 and max. If a batch receive call returns less than the max number specified, it doesn't mean there are only so many messages in the queue. Only indication that a queue or subscription is empty is when a receive call returns null. In your case, you should continue receiving in batches until it returns null.

Upvotes: 2

Related Questions