EventDataBatch Class
- java.
lang. Object - com.
azure. messaging. eventhubs. EventDataBatch
- com.
public final class EventDataBatch
A class for aggregating EventData into a single, size-limited, batch. It is treated as a single message when sent to the Azure Event Hubs service. EventDataBatch is recommended in scenarios requiring high throughput for publishing events.
Method Summary
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Gets the number of EventData in the batch. |
int |
getMaxSizeInBytes()
Gets the maximum size, in bytes, of the EventDataBatch. |
int |
getSizeInBytes()
Gets the size of the EventDataBatch in bytes. |
boolean |
tryAdd(EventData eventData)
Tries to add an EventData to the batch. |
Methods inherited from java.lang.Object
Method Details
getCount
getMaxSizeInBytes
public int getMaxSizeInBytes()
Gets the maximum size, in bytes, of the EventDataBatch.
Returns:
getSizeInBytes
public int getSizeInBytes()
Gets the size of the EventDataBatch in bytes.
Returns:
tryAdd
public boolean tryAdd(EventData eventData)
Tries to add an EventData to the batch.
This method is not thread-safe; make sure to synchronize the method access when using multiple threads to add events.
Parameters:
Returns:
true
if the event could be added to the batch; false
if the event was too large to fit in
the batch, to accommodate the event, the application should obtain a new EventDataBatch object and
add event to it.Applies to
Azure SDK for Java