EventProcessor<TPartition>.OnInitializingPartitionAsync(TPartition, CancellationToken) Method

Definition

Performs the tasks to initialize a partition, and its associated context, for event processing.

protected virtual System.Threading.Tasks.Task OnInitializingPartitionAsync (TPartition partition, System.Threading.CancellationToken cancellationToken);
abstract member OnInitializingPartitionAsync : 'Partition * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OnInitializingPartitionAsync : 'Partition * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Overridable Function OnInitializingPartitionAsync (partition As TPartition, cancellationToken As CancellationToken) As Task

Parameters

partition
TPartition

The context of the partition being initialized. Only the well-known members of the EventProcessorPartition will be populated. If a custom context is being used, the implementor of this method is responsible for initializing custom members.

cancellationToken
CancellationToken

A CancellationToken instance to signal the request to cancel the initialization. This is most likely to occur if the partition is claimed by another event processor instance or the processor is shutting down.

Returns

Task

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.

Applies to