共用方式為


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.

public virtual System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch> CreateMessageBatchAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member CreateMessageBatchAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch>
override this.CreateMessageBatchAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch>
Public Overridable Function CreateMessageBatchAsync (Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of ServiceBusMessageBatch)

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

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.

public virtual System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch> CreateMessageBatchAsync (Azure.Messaging.ServiceBus.CreateMessageBatchOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateMessageBatchAsync : Azure.Messaging.ServiceBus.CreateMessageBatchOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch>
override this.CreateMessageBatchAsync : Azure.Messaging.ServiceBus.CreateMessageBatchOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Azure.Messaging.ServiceBus.ServiceBusMessageBatch>
Public Overridable Function CreateMessageBatchAsync (options As CreateMessageBatchOptions, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of ServiceBusMessageBatch)

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