Class EventBatchContext

java.lang.Object
com.azure.messaging.eventhubs.models.EventBatchContext

public class EventBatchContext extends Object
A class that contains a batch of 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.
See Also:
  • Constructor Details

  • Method Details

    • getPartitionContext

      public PartitionContext getPartitionContext()
      Returns the partition information associated with the received event.
      Returns:
      The partition information of the received event.
    • getEvents

      public List<EventData> getEvents()
      Returns a list of event data received from Event Hub.
      Returns:
      The list of event data received from Event Hub.
    • getLastEnqueuedEventProperties

      public LastEnqueuedEventProperties getLastEnqueuedEventProperties()
      Returns the properties of the last enqueued event in this partition. If EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean) is set to false or if getEvents() is empty, this method will return null.
      Returns:
      The properties of the last enqueued event in this partition. If EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean) is set to false or if getEvents() is empty, this method will return null.
    • 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:
      Gets a Mono that completes when the checkpoint is updated.
      Throws:
      AmqpException - if an error occurs when updating the checkpoint.
    • 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.
      Throws:
      AmqpException - if an error occurs while updating the checkpoint.