4

I'd like to use the Azure Service Bus client (Microsoft.ServiceBus.dll) in async mode, but am wondering how to handle cancellation. For example, the method QueueClient.ReceiveAsync does not take any CancellationToken, so considering that this method does not return as long as there is no message in the queue, how can I gracefully interrupt it if I want to take down the receiving loop?

Thanks a lot.

ThomasWeiss
  • 1,292
  • 16
  • 30

1 Answers1

1

I answered a similar question about HttpWebRequest.GetResponseAsync here. While I'm not familiar with Azure Service Bus, I'd assume you could use QueueClient.Abort or QueueClient.Close where I used HttpWebRequest.Abort, so the pattern should remain the same.

Community
  • 1
  • 1
noseratio
  • 59,932
  • 34
  • 208
  • 486
  • 1
    Thanks for the hint, I will wait for some confirmation from someone familiar with SB before accepting the answer. – ThomasWeiss Oct 21 '13 at 08:50