It appears that if the time limit is exceeded, the callback is called. When we try to retrieve the message by calling SubscriptionClient.EndReceive()
, null
will be returned.
The default timeout value is one minute, and there is no way to set an infinite timeout. If you want an infinite timeout, you can call SubscriptionClient.BeginReceive()
again if the message is null
.
For example:
static public void DownloadResults(IAsyncResult ar)
{
// Get the message from the service bus.
msg = client.EndReceive(ar);
if (msg == null)
{
// Start waiting for the message again.
client.BeginReceive(new TimeSpan(6, 0, 0), new AsyncCallback(DownloadResults), null);
return;
}
}