Class EventContext

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

public class EventContext extends Object
A class that contains EventData and the partition information the event belongs to. This is given to the processEvent handler each time an event is received from the Event Hub. This class also includes methods to update checkpoint in CheckpointStore and retrieve the last enqueued event information.
  • 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.
    • getEventData

      public EventData getEventData()
      Returns the event data received from Event Hub.
      Returns:
      The 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, this method will return null.
      Returns:
      The properties of the last enqueued event in this partition. If EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean) is set to false, this method will return null.
    • updateCheckpointAsync

      public Mono<Void> updateCheckpointAsync()
      Updates the checkpoint asynchronously for this partition using the event data in this EventContext. This will serve as the last known successfully processed event in this partition if the update is successful.
      Returns:
      a representation of deferred execution of this call.
    • updateCheckpoint

      public void updateCheckpoint()
      Updates the checkpoint synchronously for this partition using the event data. This will serve as the last known successfully processed event in this partition if the update is successful.