public class EventContext extends Object
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 and Description |
---|
EventContext(PartitionContext partitionContext,
EventData eventData,
CheckpointStore checkpointStore,
LastEnqueuedEventProperties lastEnqueuedEventProperties)
Creates an instance of
EventContext . |
Modifier and Type | Method and Description |
---|---|
EventData |
getEventData()
Returns the 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 event data.
|
Mono<Void> |
updateCheckpointAsync(EventData eventData)
Updates the checkpoint asynchronously for this partition using the event data.
|
public EventContext(PartitionContext partitionContext, EventData eventData, CheckpointStore checkpointStore, LastEnqueuedEventProperties lastEnqueuedEventProperties)
EventContext
.partitionContext
- The partition information associated with the received event.eventData
- The event 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 EventData getEventData()
public LastEnqueuedEventProperties getLastEnqueuedEventProperties()
EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean)
is set to false
, this method will
return null
.EventProcessorClientBuilder.trackLastEnqueuedEventProperties(boolean)
is set to false
, this
method will return null
.public Mono<Void> updateCheckpointAsync(EventData eventData)
eventData
- The event data to use for updating the checkpoint.public void updateCheckpoint()
Copyright © 2019 Microsoft Corporation. All rights reserved.