ServiceBusSender.CreateMessageBatchAsync Method

Definition

Overloads

CreateMessageBatchAsync(CancellationToken)

Creates a size-constraint batch to which ServiceBusMessage may be added using a TryAddMessage(ServiceBusMessage). If a message would exceed the maximum allowable size of the batch, the batch will not allow adding the message and signal that scenario using it return value.

Because messages that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the messages to the Queue/Topic.

CreateMessageBatchAsync(CreateMessageBatchOptions, CancellationToken)

Creates a size-constraint batch to which ServiceBusMessage may be added using a try-based pattern. If a message would exceed the maximum allowable size of the batch, the batch will not allow adding the message and signal that scenario using its return value.

Because messages that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the messages to the Queue/Topic.

CreateMessageBatchAsync(CancellationToken)

Source:
ServiceBusSender.cs
Source:
ServiceBusSender.cs

Creates a size-constraint batch to which ServiceBusMessage may be added using a TryAddMessage(ServiceBusMessage). If a message would exceed the maximum allowable size of the batch, the batch will not allow adding the message and signal that scenario using it return value.

Because messages that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the messages to the Queue/Topic.

C#
public virtual System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch> CreateMessageBatchAsync(System.Threading.CancellationToken cancellationToken = default);

Parameters

cancellationToken
CancellationToken

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

Returns

An ServiceBusMessageBatch with the default batch options.

See also

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

CreateMessageBatchAsync(CreateMessageBatchOptions, CancellationToken)

Source:
ServiceBusSender.cs
Source:
ServiceBusSender.cs

Creates a size-constraint batch to which ServiceBusMessage may be added using a try-based pattern. If a message would exceed the maximum allowable size of the batch, the batch will not allow adding the message and signal that scenario using its return value.

Because messages that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when attempting to send the messages to the Queue/Topic.

C#
public virtual System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch> CreateMessageBatchAsync(Azure.Messaging.ServiceBus.CreateMessageBatchOptions options, System.Threading.CancellationToken cancellationToken = default);

Parameters

options
CreateMessageBatchOptions

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 ServiceBusMessageBatch with the requested options.

See also

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview