EventProcessor<TPartition>.OnInitializingPartitionAsync 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

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, limited to one call per partition. The processor will await each invocation before beginning to process the associated partition.

The processor will wait indefinitely for execution of the handler to complete. It is recommended for implementations to avoid long-running operations, as they will delay processing for the associated partition.

Applies to