Class ServiceBusMessageBatch
java.lang.Object
com.azure.messaging.servicebus.ServiceBusMessageBatch
-
Method Summary
Modifier and TypeMethodDescriptionintgetCount()Gets the number ofmessagesin the batch.intGets the maximum size, in bytes, of thebatch.intGets the size of thebatchin bytes.booleantryAddMessage(ServiceBusMessage serviceBusMessage) Tries to add amessageto the batch.
-
Method Details
-
getCount
-
getMaxSizeInBytes
-
getSizeInBytes
-
tryAddMessage
Tries to add amessageto the batch.This method is not thread-safe; make sure to synchronize the method access when using multiple threads to add messages.
- Parameters:
serviceBusMessage- TheServiceBusMessageto add to the batch.- Returns:
trueif the message could be added to the batch;falseif the event was too large to fit in the batch.- Throws:
NullPointerException- ifmessageisnull.com.azure.core.amqp.exception.AmqpException- ifmessageis larger than the maximum size of theServiceBusMessageBatch.
-