EventBatchContext Class
- java.
lang. Object - com.
azure. messaging. eventhubs. models. EventBatchContext
- com.
public class EventBatchContext
A class that contains a batch of EventData and the partition information the event batch belongs to. This is given to the processEventBatch(Consumer<EventBatchContext> processEventBatch, int maxBatchSize) and processEventBatch(Consumer<EventBatchContext> processEventBatch, int maxBatchSize, Duration maxWaitTime) handlers each time an event batch is received from the Event Hub. This class also includes methods to update checkpoint in CheckpointStore and retrieve the last enqueued event information.
Constructor Summary
| Constructor | Description |
|---|---|
| EventBatchContext(PartitionContext partitionContext, List<EventData> events, CheckpointStore checkpointStore, LastEnqueuedEventProperties lastEnqueuedEventProperties) |
Creates an instance of EventBatchContext. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
List<Event |
getEvents()
Returns a list of event data received from Event Hub. |
|
Last |
getLastEnqueuedEventProperties()
Returns the properties of the last enqueued event in this partition. |
|
Partition |
getPartitionContext()
Returns the partition information associated with the received event. |
| void |
updateCheckpoint()
Updates the checkpoint synchronously for this partition using the last event in the list provided by getEvents(). |
| reactor.core.publisher.Mono<Void> |
updateCheckpointAsync()
Updates the checkpoint asynchronously for this partition using the last event in the list provided by getEvents(). |
Methods inherited from java.lang.Object
Constructor Details
EventBatchContext
public EventBatchContext(PartitionContext partitionContext, List<EventData> events, CheckpointStore checkpointStore, LastEnqueuedEventProperties lastEnqueuedEventProperties)
Creates an instance of EventBatchContext.
Parameters:
false, this will be
null.
Method Details
getEvents
public List<EventData> getEvents()
Returns a list of event data received from Event Hub. An empty list can be returned if processEventBatch(Consumer<EventBatchContext> processEventBatch, int maxBatchSize, Duration maxWaitTime) was used to construct the processor. This means that no events were received during the specified duration.
Returns:
getLastEnqueuedEventProperties
public LastEnqueuedEventProperties getLastEnqueuedEventProperties()
Returns the properties of the last enqueued event in this partition. If trackLastEnqueuedEventProperties(boolean trackLastEnqueuedEventProperties) is set to false or if getEvents() is empty, this method will return null.
Returns:
false or if getEvents() is empty, this method will return null.getPartitionContext
public PartitionContext getPartitionContext()
Returns the partition information associated with the received event.
Returns:
updateCheckpoint
public void updateCheckpoint()
Updates the checkpoint synchronously for this partition using the last event in the list provided by getEvents(). This will serve as the last known successfully processed event in this partition if the update is successful. If getEvents() returns an empty, no update to checkpoint will be done.
updateCheckpointAsync
public Mono<Void> updateCheckpointAsync()
Updates the checkpoint asynchronously for this partition using the last event in the list provided by getEvents(). This will serve as the last known successfully processed event in this partition if the update is successful. If getEvents() returns an empty, no update to checkpoint will be done.
Returns: