Aracılığıyla paylaş


EventProcessorClient.ClaimOwnershipAsync Method

Definition

Attempts to claim ownership of the specified partitions for processing. This method is used by load balancing to allow event processor instances to distribute the responsibility for processing partitions for a given Event Hub and consumer group pairing amongst the active event processors.

protected override 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);
override this.ClaimOwnershipAsync : seq<Azure.Messaging.EventHubs.Primitives.EventProcessorPartitionOwnership> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<seq<Azure.Messaging.EventHubs.Primitives.EventProcessorPartitionOwnership>>
Protected Overrides 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