Pittsburgh DBA
Pittsburgh DBA

Reputation: 6772

Azure Service Bus - SuscriptionClient.BeginAcceptMessageSession() and TimeoutException

The documentation leads one to believe that BeginAcceptMessageSession() will throw a TimeoutException if the amount of time specified in the serverWaitTime parameter is exceeded. This does not always seem to happen.

So, is the behavior of this thing such that it is not supposed to hand back a MessageSession if there are no messages in the Topic (i.e. it waits a certain period of time, and upon finding no messages, it throws the TimeoutException)? Or, rather, does it only time out if it cannot answer back within the time frame, regardless of whether or not there messages?

I am conducting VERY simple testing on an empty Topic, and an empty Subscription. Using a 5 second timeout value, sometimes it throws the TimeoutException and sometimes it does not.

What gives? Why is this thing not consistent? What is the rule for when the TimeoutException will or will not be thrown? Can I get a MessageSession back on an empty Subscription?

These docs are downright sparse.

Thank you for any help that you can provide.

Upvotes: 1

Views: 328

Answers (1)

Ruben Bartelink
Ruben Bartelink

Reputation: 61795

Yes, the undocumentation is pretty impressive alright.

Are you Close()ing the MessageSession in the case where you do get it?

Remember the returned object represents a token which grants you exclusive rights to dequeue from the topic until you return it or someone else 'wins' it.

Upvotes: 1

Related Questions