EventProcessor<TPartition>.OnPartitionProcessingStoppedAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Performs the tasks needed when processing for a partition is being stopped. This commonly occurs when the partition is claimed by another event processor instance or when the current event processor instance is shutting down.
protected virtual System.Threading.Tasks.Task OnPartitionProcessingStoppedAsync (TPartition partition, Azure.Messaging.EventHubs.Processor.ProcessingStoppedReason reason, System.Threading.CancellationToken cancellationToken);
abstract member OnPartitionProcessingStoppedAsync : 'Partition * Azure.Messaging.EventHubs.Processor.ProcessingStoppedReason * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OnPartitionProcessingStoppedAsync : 'Partition * Azure.Messaging.EventHubs.Processor.ProcessingStoppedReason * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Overridable Function OnPartitionProcessingStoppedAsync (partition As TPartition, reason As ProcessingStoppedReason, cancellationToken As CancellationToken) As Task
Parameters
- partition
- TPartition
The context of the partition for which processing is being stopped.
- reason
- ProcessingStoppedReason
The reason that processing is being stopped for the partition.
- cancellationToken
- CancellationToken
A CancellationToken instance to signal the request to cancel the processing. This is not expected to signal under normal circumstances and will only occur if the processor encounters an unrecoverable error.
Returns
Remarks
It is not recommended that the state of the processor be managed directly from within this method; requesting to start or stop the processor may result in a deadlock scenario, especially if using the synchronous form of the call.
This method will be invoked concurrently, as each close is independent. No time limit is imposed on an invocation; it is safe for implementations to perform long-running operations and retries as needed. This handler has no influence on processing for the associated partition and offers no guarantee that execution will complete before processing for the partition is restarted or migrates to a new host.