EventHubProducerClient.CreateBatchAsync 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
CreateBatchAsync(CancellationToken) |
Creates a size-constraint batch to which EventData may be added using a try-based pattern. If an event would exceed the maximum allowable size of the batch, the batch will not allow adding the event and signal that scenario using its return value. Because events that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the events to the Event Hubs service. |
CreateBatchAsync(CreateBatchOptions, CancellationToken) |
Creates a size-constraint batch to which EventData may be added using a try-based pattern. If an event would exceed the maximum allowable size of the batch, the batch will not allow adding the event and signal that scenario using its return value. Because events that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the events to the Event Hubs service. |
CreateBatchAsync(CancellationToken)
- Source:
- EventHubProducerClient.cs
- Source:
- EventHubProducerClient.cs
Creates a size-constraint batch to which EventData may be added using a try-based pattern. If an event would exceed the maximum allowable size of the batch, the batch will not allow adding the event and signal that scenario using its return value.
Because events that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the events to the Event Hubs service.
public virtual System.Threading.Tasks.ValueTask<Azure.Messaging.EventHubs.Producer.EventDataBatch> CreateBatchAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member CreateBatchAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.EventHubs.Producer.EventDataBatch>
override this.CreateBatchAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.EventHubs.Producer.EventDataBatch>
Public Overridable Function CreateBatchAsync (Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of EventDataBatch)
Parameters
- cancellationToken
- CancellationToken
An optional CancellationToken instance to signal the request to cancel the operation.
Returns
An EventDataBatch with the default batch options.
See also
- CreateBatchAsync(CreateBatchOptions, CancellationToken)
- SendAsync(EventDataBatch, CancellationToken)
Applies to
CreateBatchAsync(CreateBatchOptions, CancellationToken)
- Source:
- EventHubProducerClient.cs
- Source:
- EventHubProducerClient.cs
Creates a size-constraint batch to which EventData may be added using a try-based pattern. If an event would exceed the maximum allowable size of the batch, the batch will not allow adding the event and signal that scenario using its return value.
Because events that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the events to the Event Hubs service.
public virtual System.Threading.Tasks.ValueTask<Azure.Messaging.EventHubs.Producer.EventDataBatch> CreateBatchAsync (Azure.Messaging.EventHubs.Producer.CreateBatchOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateBatchAsync : Azure.Messaging.EventHubs.Producer.CreateBatchOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.EventHubs.Producer.EventDataBatch>
override this.CreateBatchAsync : Azure.Messaging.EventHubs.Producer.CreateBatchOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.EventHubs.Producer.EventDataBatch>
Public Overridable Function CreateBatchAsync (options As CreateBatchOptions, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of EventDataBatch)
Parameters
- options
- CreateBatchOptions
The set of options to consider when creating this batch.
- cancellationToken
- CancellationToken
An optional CancellationToken instance to signal the request to cancel the operation.
Returns
An EventDataBatch with the requested options
.
Exceptions
Occurs when both a partition identifier and partition key have been specified in the options
.