EventHubBufferedProducerClient.SendEventBatchFailedAsync Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Invoked for any batch of events that failed to be published to the Event Hub, this handler must be provided before events may be enqueued. If this producer was not configured with MaximumConcurrentSends and MaximumConcurrentSendsPerPartition both set to 1, the handler will be invoked concurrently.
It is safe to attempt resending the events by calling EnqueueEventAsync(EventData, EnqueueEventOptions, CancellationToken) or EnqueueEventsAsync(IEnumerable<EventData>, EnqueueEventOptions, CancellationToken) from within this handler. It is important to note that doing so will place them at the end of the buffer; the original order will not be maintained.
This handler will be awaited after failure to publish the batch; the publishing operation is not considered complete until the handler call returns. It is advised that no long-running operations be performed in the handler to avoid negatively impacting throughput.
It is not recommended to invoke CloseAsync(Boolean, CancellationToken) or DisposeAsync() from this handler; doing so may result in a deadlock scenario if those calls are awaited.
public event Func<Azure.Messaging.EventHubs.Producer.SendEventBatchFailedEventArgs,System.Threading.Tasks.Task> SendEventBatchFailedAsync;
member this.SendEventBatchFailedAsync : Func<Azure.Messaging.EventHubs.Producer.SendEventBatchFailedEventArgs, System.Threading.Tasks.Task>
Public Custom Event SendEventBatchFailedAsync As Func(Of SendEventBatchFailedEventArgs, Task)
Event Type
Exceptions
If an attempt is made to remove a handler that doesn't match the current handler registered.
If an attempt is made to add a handler when one is currently registered.
Remarks
Should a transient failure occur during publishing, this handler will not be invoked immediately; it is only invoked after applying the retry policy and all eligible retries have been exhausted. Should publishing succeed during a retry attempt, this handler is not invoked.
Since applications do not have deterministic control over failed batches, it is recommended that the application set a generous number of retries and try timeout interval in the RetryOptions. Doing so will allow the EventHubBufferedProducerClient a higher chance to recover from transient failures. This is especially important when ensuring the order of events is needed.
It is not necessary to explicitly unregister this handler; it will be automatically unregistered when CloseAsync(Boolean, CancellationToken) or DisposeAsync() is invoked.
Applies to
See also
Azure SDK for .NET