PartitionContext Class

Contains partition related context information.

A PartitionContext instance will be passed to the event, error and initialization callbacks defined when calling EventHubConsumerClient.receive(). Users can call update_checkpoint() of this class to persist checkpoint data.

Inheritance
builtins.object
PartitionContext

Constructor

PartitionContext(fully_qualified_namespace: str, eventhub_name: str, consumer_group: str, partition_id: str, checkpoint_store: CheckpointStore | None = None)

Parameters

Name Description
fully_qualified_namespace
Required
eventhub_name
Required
consumer_group
Required
partition_id
Required
checkpoint_store
Default value: None

Methods

update_checkpoint

Updates the receive checkpoint to the given events offset.

update_checkpoint

Updates the receive checkpoint to the given events offset.

async update_checkpoint(event: EventData | None = None, **kwargs: Any) -> None

Parameters

Name Description
event

The EventData instance which contains the offset and sequence number information used for checkpoint.

Default value: None

Returns

Type Description

Attributes

last_enqueued_event_properties

The latest enqueued event information.

This property will be updated each time an event is received if the receiver is created with track_last_enqueued_event_properties set to True. The properties dict includes following information of the last enqueued event:

  • sequence_number (int)

  • offset (str)

  • enqueued_time (UTC datetime.datetime)

  • retrieval_time (UTC datetime.datetime)

Returns

Type Description
dict,