How to use a CancellationToken with the Azure Service Bus Queue client? How to use a CancellationToken with the Azure Service Bus Queue client? azure azure

How to use a CancellationToken with the Azure Service Bus Queue client?


You probably could use QueueClient.Abort like this:

using (cancellationToken.Register(() => queueClient.Abort()){    var messages = await queueClient.ReceiveBatchAsync(        10, TimeSpan.FromSeconds(30));    return messages; // or process it }