ServiceBusMessageBatch interface
A batch of messages that you can create using the <xref:createBatch> method.
Properties
count | Number of messages added to the batch. |
max |
The maximum size of the batch, in bytes. The |
size |
Size of the batch in bytes after the events added to it have been encoded into a single AMQP message. |
Methods
try |
Adds a message to the batch if permitted by the batch's size limit. NOTE: Always remember to check the return value of this method, before calling it again for the next event. |
Property Details
count
Number of messages added to the batch.
count: number
Property Value
number
maxSizeInBytes
The maximum size of the batch, in bytes. The tryAddMessage
function on the batch will return false
if the message being added causes the size of the batch to exceed this limit. Use the createMessageBatch()
method on
the Sender
to set the maxSizeInBytes.
maxSizeInBytes: number
Property Value
number
sizeInBytes
Size of the batch in bytes after the events added to it have been encoded into a single AMQP message.
sizeInBytes: number
Property Value
number
Method Details
tryAddMessage(ServiceBusMessage | AmqpAnnotatedMessage, TryAddOptions)
Adds a message to the batch if permitted by the batch's size limit. NOTE: Always remember to check the return value of this method, before calling it again for the next event.
function tryAddMessage(message: ServiceBusMessage | AmqpAnnotatedMessage, options?: TryAddOptions): boolean
Parameters
- message
The message to add to the batch.
- options
- TryAddOptions
Returns
boolean
A boolean value indicating if the message has been added to the batch or not.