I am writing a test program to process messages in an Azure Service Bus Queue. I want to be able to provide the the ability to start and stop the dequeueing functionality.
If I am wondering if there is a way to cancel a call to QueueClient.Receive(TimeSpan)? There is a QueueClient.Abort() method, and also a QueueClient.Close() method, but the documentation on these is sparse. And, there does not seem to be a corresponding method to "Open" after aborting or closing.
If there is no way to cancel a long running receive, then I am stuck using a short (or no) TimeSpan in order to get a chance for the user to stop dequeueing. And by doing that I'm pretty much doing polling myself, which defeats the advantage of the long running receive functionality.
I'm new to using the Service Bus Queue, so maybe I'm on the wrong track with my approach here, and not understanding the spirit of how messages in the queue are supposed to be processed?
The by-design solution is indeed to close the client.