Dela via


ServiceBusMessageBatch Class

Definition

A set of ServiceBusMessage with size constraints known up-front, intended to be sent to the Queue/Topic as a single batch. A ServiceBusMessageBatch can be created using CreateMessageBatchAsync(CancellationToken). Messages can be added to the batch using the TryAddMessage(ServiceBusMessage) method on the batch.

public sealed class ServiceBusMessageBatch : IDisposable
type ServiceBusMessageBatch = class
    interface IDisposable
Public NotInheritable Class ServiceBusMessageBatch
Implements IDisposable
Inheritance
ServiceBusMessageBatch
Implements

Properties

Count

The count of messages contained in the batch.

MaxSizeInBytes

The maximum size allowed for the batch, in bytes. This includes the messages in the batch as well as any overhead for the batch itself when sent to the Queue/Topic.

SizeInBytes

The size of the batch, in bytes, as it will be sent to the Queue/Topic.

Methods

Dispose()

Performs the task needed to clean up resources used by the ServiceBusMessageBatch.

TryAddMessage(ServiceBusMessage)

Attempts to add a message to the batch, ensuring that the size of the batch does not exceed its maximum.

Applies to