Share via


EventHubBufferedProducerClient.EnqueueEventsAsync Method

Definition

Overloads

EnqueueEventsAsync(IEnumerable<EventData>, CancellationToken)

Enqueues a set of EventData into the buffer to be published to the Event Hub. If there is insufficient capacity in the buffer when this method is invoked, it will wait for space to become available and ensure that all events in the events set have been enqueued.

When this call returns, the events have been accepted into the buffer, but it may not have been published yet. Publishing will take place at a nondeterministic point in the future as the buffer is processed.

EnqueueEventsAsync(IEnumerable<EventData>, EnqueueEventOptions, CancellationToken)

Enqueues a set of EventData into the buffer to be published to the Event Hub. If there is insufficient capacity in the buffer when this method is invoked, it will wait for space to become available and ensure that all events in the events set have been enqueued.

When this call returns, the events have been accepted into the buffer, but it may not have been published yet. Publishing will take place at a nondeterministic point in the future as the buffer is processed.

EnqueueEventsAsync(IEnumerable<EventData>, CancellationToken)

Source:
EventHubBufferedProducerClient.cs
Source:
EventHubBufferedProducerClient.cs

Enqueues a set of EventData into the buffer to be published to the Event Hub. If there is insufficient capacity in the buffer when this method is invoked, it will wait for space to become available and ensure that all events in the events set have been enqueued.

When this call returns, the events have been accepted into the buffer, but it may not have been published yet. Publishing will take place at a nondeterministic point in the future as the buffer is processed.

public virtual System.Threading.Tasks.Task<int> EnqueueEventsAsync (System.Collections.Generic.IEnumerable<Azure.Messaging.EventHubs.EventData> events, System.Threading.CancellationToken cancellationToken = default);
abstract member EnqueueEventsAsync : seq<Azure.Messaging.EventHubs.EventData> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
override this.EnqueueEventsAsync : seq<Azure.Messaging.EventHubs.EventData> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
Public Overridable Function EnqueueEventsAsync (events As IEnumerable(Of EventData), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Integer)

Parameters

events
IEnumerable<EventData>

The set of events to be enqueued into the buffer and, later, published.

cancellationToken
CancellationToken

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

Returns

The total number of events that are currently buffered and waiting to be published, across all partitions.

Exceptions

Occurs when no SendEventBatchFailedAsync handler is currently registered.

Occurs when querying Event Hub metadata took longer than expected.

Remarks

Should cancellation or an unexpected exception occur, it is possible for calls to this method to result in a partial failure where some, but not all, of the events have enqueued. For scenarios where it is important to understand whether each individual event has been enqueued, it is recommended to call the see EnqueueEventAsync(EventData, EnqueueEventOptions, CancellationToken) or EnqueueEventAsync(EventData, CancellationToken) overloads instead of this method.

Upon the first attempt to enqueue events, the SendEventBatchSucceededAsync and SendEventBatchFailedAsync handlers can no longer be changed.

Applies to

EnqueueEventsAsync(IEnumerable<EventData>, EnqueueEventOptions, CancellationToken)

Source:
EventHubBufferedProducerClient.cs
Source:
EventHubBufferedProducerClient.cs

Enqueues a set of EventData into the buffer to be published to the Event Hub. If there is insufficient capacity in the buffer when this method is invoked, it will wait for space to become available and ensure that all events in the events set have been enqueued.

When this call returns, the events have been accepted into the buffer, but it may not have been published yet. Publishing will take place at a nondeterministic point in the future as the buffer is processed.

public virtual System.Threading.Tasks.Task<int> EnqueueEventsAsync (System.Collections.Generic.IEnumerable<Azure.Messaging.EventHubs.EventData> events, Azure.Messaging.EventHubs.Producer.EnqueueEventOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member EnqueueEventsAsync : seq<Azure.Messaging.EventHubs.EventData> * Azure.Messaging.EventHubs.Producer.EnqueueEventOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
override this.EnqueueEventsAsync : seq<Azure.Messaging.EventHubs.EventData> * Azure.Messaging.EventHubs.Producer.EnqueueEventOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
Public Overridable Function EnqueueEventsAsync (events As IEnumerable(Of EventData), options As EnqueueEventOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Integer)

Parameters

events
IEnumerable<EventData>

The set of events to be enqueued into the buffer and, later, published.

options
EnqueueEventOptions

The set of options to apply when publishing these events.

cancellationToken
CancellationToken

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

Returns

The total number of events that are currently buffered and waiting to be published, across all partitions.

Exceptions

Occurs when an invalid partition identifier has been specified in the options.

Occurs when the EventHubBufferedProducerClient was unable to start within the configured timeout period.

Remarks

Should cancellation or an unexpected exception occur, it is possible for calls to this method to result in a partial failure where some, but not all, of the events have enqueued. For scenarios where it is important to understand whether each individual event has been enqueued, it is recommended to call the see EnqueueEventAsync(EventData, EnqueueEventOptions, CancellationToken) or EnqueueEventAsync(EventData, CancellationToken) overloads instead of this method.

Upon the first attempt to enqueue events, the SendEventBatchSucceededAsync and SendEventBatchFailedAsync handlers can no longer be changed.

Applies to