Delen via


EventHubBufferedProducerClient.DisposeAsync 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.ValueTask DisposeAsync ();
abstract member DisposeAsync : unit -> System.Threading.Tasks.ValueTask
override this.DisposeAsync : unit -> System.Threading.Tasks.ValueTask
Public Overridable Function DisposeAsync () As ValueTask

Returns

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

Implements

Remarks

Calling this method will also invoke Azure.Messaging.EventHubs.Producer.EventHubBufferedProducerClient.FlushInternalAsync(System.Threading.CancellationToken), which will attempt to publish any events that are still pending, and finish any active sending. It will also automatically unregister the SendEventBatchSucceededAsync and SendEventBatchFailedAsync handlers.

This method is identical to CloseAsync(Boolean, CancellationToken) and either can be used to send pending events and clean up resources.

Applies to