public class EventBatchContext extends Object
EventData and the partition information the event batch belongs to. This is
given to the processEventBatch handler 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 and Description |
|---|
EventBatchContext(PartitionContext partitionContext,
List<EventData> events,
CheckpointStore checkpointStore,
LastEnqueuedEventProperties lastEnqueuedEventProperties)
Creates an instance of
EventContext. |
| Modifier and Type | Method and Description |
|---|---|
List<EventData> |
getEvents()
Returns a list of event data received from Event Hub.
|
LastEnqueuedEventProperties |
getLastEnqueuedEventProperties()
Returns the properties of the last enqueued event in this partition.
|
PartitionContext |
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
EventBatchContext.getEvents(). |
Mono<Void> |
updateCheckpointAsync()
Updates the checkpoint asynchronously for this partition using the last event in the list provided by
EventBatchContext.getEvents(). |
public EventBatchContext(PartitionContext partitionContext, List<EventData> events, CheckpointStore checkpointStore, LastEnqueuedEventProperties lastEnqueuedEventProperties)
EventContext.partitionContext - The partition information associated with the received event.events - The list of events received from Event Hub.checkpointStore - The checkpoint store that is used for updating checkpoints.lastEnqueuedEventProperties - The properties of the last enqueued event in this partition. If EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean) is set to false, this will be
null.NullPointerException - If partitionContext, eventData or checkpointStore is null.public PartitionContext getPartitionContext()
public List<EventData> getEvents()
public LastEnqueuedEventProperties getLastEnqueuedEventProperties()
EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean) is set to false or if
EventBatchContext.getEvents() is empty, this method will return null.EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean) is
set to false or if EventBatchContext.getEvents() is empty, this method will return null.public Mono<Void> updateCheckpointAsync()
EventBatchContext.getEvents(). This will serve as the last known successfully processed event in this partition
if the update is successful. If EventBatchContext.getEvents() returns an empty, no update to checkpoint will be
done.Mono that completes when the checkpoint is updated.com.azure.core.amqp.exception.AmqpException - if an error occurs when updating the checkpoint.public void updateCheckpoint()
EventBatchContext.getEvents(). This will serve as the last known successfully processed event in this partition
if the update is successful. If EventBatchContext.getEvents() returns an empty, no update to checkpoint will be
done.com.azure.core.amqp.exception.AmqpException - if an error occurs while updating the checkpoint.Copyright © 2021 Microsoft Corporation. All rights reserved.