EventProcessor<TPartition>.ClaimOwnershipAsync Method

Definition

Attempts to claim ownership of the specified partitions for processing. This operation is used by load balancing to enable distributing the responsibility for processing partitions for an Event Hub and consumer group pairing amongst the active event processors.

protected abstract System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Azure.Messaging.EventHubs.Primitives.EventProcessorPartitionOwnership>> ClaimOwnershipAsync (System.Collections.Generic.IEnumerable<Azure.Messaging.EventHubs.Primitives.EventProcessorPartitionOwnership> desiredOwnership, System.Threading.CancellationToken cancellationToken);
abstract member ClaimOwnershipAsync : seq<Azure.Messaging.EventHubs.Primitives.EventProcessorPartitionOwnership> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<seq<Azure.Messaging.EventHubs.Primitives.EventProcessorPartitionOwnership>>
Protected MustOverride Function ClaimOwnershipAsync (desiredOwnership As IEnumerable(Of EventProcessorPartitionOwnership), cancellationToken As CancellationToken) As Task(Of IEnumerable(Of EventProcessorPartitionOwnership))

Parameters

desiredOwnership
IEnumerable<EventProcessorPartitionOwnership>

The set of partition ownership desired by the event processor instance; this is the set of partitions that it will attempt to request responsibility for processing.

cancellationToken
CancellationToken

A CancellationToken instance to signal the request to cancel the processing. This is most likely to occur when the processor is shutting down.

Returns

The set of ownership records for the partitions that were successfully claimed; this is expected to be the desiredOwnership or a subset of those partitions.

Applies to