EventHubProducerClient.SendAsync Method
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.
Overloads
SendAsync(EventDataBatch, CancellationToken) |
Sends a set of events to the associated Event Hub using a batched approach. |
SendAsync(IEnumerable<EventData>, CancellationToken) |
Sends a set of events to the associated Event Hub as a single operation. To avoid the overhead associated with measuring and validating the size in the client, validation will be delegated to the Event Hubs service and is deferred until the operation is invoked. The call will fail if the size of the specified set of events exceeds the maximum allowable size of a single batch. |
SendAsync(IEnumerable<EventData>, SendEventOptions, CancellationToken) |
Sends a set of events to the associated Event Hub as a single operation. To avoid the overhead associated with measuring and validating the size in the client, validation will be delegated to the Event Hubs service and is deferred until the operation is invoked. The call will fail if the size of the specified set of events exceeds the maximum allowable size of a single batch. |
SendAsync(EventDataBatch, CancellationToken)
- Source:
- EventHubProducerClient.cs
- Source:
- EventHubProducerClient.cs
Sends a set of events to the associated Event Hub using a batched approach.
public virtual System.Threading.Tasks.Task SendAsync (Azure.Messaging.EventHubs.Producer.EventDataBatch eventBatch, System.Threading.CancellationToken cancellationToken = default);
abstract member SendAsync : Azure.Messaging.EventHubs.Producer.EventDataBatch * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SendAsync : Azure.Messaging.EventHubs.Producer.EventDataBatch * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function SendAsync (eventBatch As EventDataBatch, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- eventBatch
- EventDataBatch
The set of event data to send. A batch may be created using CreateBatchAsync(CancellationToken).
- 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; if no exception is thrown when awaited, the Event Hubs service has acknowledge receipt and assumed responsibility for delivery of the batch.
Exceptions
Occurs when both a partition identifier and partition key have been specified by the batch.
Remarks
When published, the result is atomic; either all events that belong to the batch were successful or all have failed. Partial success is not possible.
See also
Applies to
SendAsync(IEnumerable<EventData>, CancellationToken)
- Source:
- EventHubProducerClient.cs
- Source:
- EventHubProducerClient.cs
Sends a set of events to the associated Event Hub as a single operation. To avoid the overhead associated with measuring and validating the size in the client, validation will be delegated to the Event Hubs service and is deferred until the operation is invoked. The call will fail if the size of the specified set of events exceeds the maximum allowable size of a single batch.
public virtual System.Threading.Tasks.Task SendAsync (System.Collections.Generic.IEnumerable<Azure.Messaging.EventHubs.EventData> eventBatch, System.Threading.CancellationToken cancellationToken = default);
abstract member SendAsync : seq<Azure.Messaging.EventHubs.EventData> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SendAsync : seq<Azure.Messaging.EventHubs.EventData> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function SendAsync (eventBatch As IEnumerable(Of EventData), Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- eventBatch
- IEnumerable<EventData>
The set of event data to send.
- 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; if no exception is thrown when awaited, the Event Hubs service has acknowledged receipt and assumed responsibility for delivery of the set of events to its partition.
Exceptions
Occurs when the set of events exceeds the maximum size allowed in a single batch, as determined by the Event Hubs service. The Reason will be set to MessageSizeExceeded in this case.
Occurs when one of the events in the eventBatch
has a member in the Properties collection that is an
unsupported type for serialization. See the Properties remarks for details.
Remarks
When published, the result is atomic; either all events that belong to the set were successful or all have failed. Partial success is not possible.
See also
- SendAsync(EventDataBatch, CancellationToken)
- CreateBatchAsync(CancellationToken)
- SendAsync(IEnumerable<EventData>, SendEventOptions, CancellationToken)
Applies to
SendAsync(IEnumerable<EventData>, SendEventOptions, CancellationToken)
- Source:
- EventHubProducerClient.cs
- Source:
- EventHubProducerClient.cs
Sends a set of events to the associated Event Hub as a single operation. To avoid the overhead associated with measuring and validating the size in the client, validation will be delegated to the Event Hubs service and is deferred until the operation is invoked. The call will fail if the size of the specified set of events exceeds the maximum allowable size of a single batch.
public virtual System.Threading.Tasks.Task SendAsync (System.Collections.Generic.IEnumerable<Azure.Messaging.EventHubs.EventData> eventBatch, Azure.Messaging.EventHubs.Producer.SendEventOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member SendAsync : seq<Azure.Messaging.EventHubs.EventData> * Azure.Messaging.EventHubs.Producer.SendEventOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SendAsync : seq<Azure.Messaging.EventHubs.EventData> * Azure.Messaging.EventHubs.Producer.SendEventOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function SendAsync (eventBatch As IEnumerable(Of EventData), options As SendEventOptions, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- eventBatch
- IEnumerable<EventData>
The set of event data to send.
- options
- SendEventOptions
The set of options to consider when sending this batch.
- 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; if no exception is thrown when awaited, the Event Hubs service has acknowledged receipt and assumed responsibility for delivery of the set of events to its partition.
Exceptions
Occurs when both a partition identifier and partition key have been specified in the options
.
Occurs when the set of events exceeds the maximum size allowed in a single batch, as determined by the Event Hubs service. The Reason will be set to MessageSizeExceeded in this case.
Occurs when one of the events in the eventBatch
has a member in the Properties collection that is an
unsupported type for serialization. See the Properties remarks for details.
Remarks
When published, the result is atomic; either all events that belong to the set were successful or all have failed. Partial success is not possible.
See also
- SendAsync(EventDataBatch, CancellationToken)
- CreateBatchAsync(CreateBatchOptions, CancellationToken)
- SendAsync(IEnumerable<EventData>, CancellationToken)