EventHubBufferedProducerClient.CloseAsync(Boolean, CancellationToken) Method

Definition

Closes the producer and performs the tasks needed to clean up all the resources used by the EventHubBufferedProducerClient.

public virtual System.Threading.Tasks.Task CloseAsync (bool flush = true, System.Threading.CancellationToken cancellationToken = default);
abstract member CloseAsync : bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.CloseAsync : bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function CloseAsync (Optional flush As Boolean = true, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

flush
Boolean

true if all buffered events that are pending should be published before closing; false to abandon all events and close immediately.

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

A task to be resolved on when the operation has completed.

Remarks

This method will automatically unregister the SendEventBatchSucceededAsync and SendEventBatchFailedAsync handlers.

Applies to