ServiceBusProcessor.StopProcessingAsync(CancellationToken) Method

Definition

Signals the processor to stop processing messaging. Should this method be called while the processor is not running, no action is taken. This method will not close the underlying receivers, but will cause the receivers to stop receiving. Any in-flight message handlers will be awaited, and this method will not return until all in-flight message handlers have returned. To close the underlying receivers, CloseAsync(CancellationToken) should be called. If CloseAsync(CancellationToken) is called, the processor cannot be restarted. If you wish to resume processing at some point after calling this method, you can call StartProcessingAsync(CancellationToken).

public virtual System.Threading.Tasks.Task StopProcessingAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member StopProcessingAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.StopProcessingAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function StopProcessingAsync (Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

cancellationToken
CancellationToken

A CancellationToken instance to signal the request to cancel the stop operation. If the operation is successfully canceled, the processor will keep running.

Returns

Task

Applies to