你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

PartitionContext 类

包含与分区相关的上下文信息。

PartitionContext 实例将传递给调用 EventHubConsumerClient.receive () 时定义的事件、错误和初始化回调。 用户可以调用此类 的 update_checkpoint () 来保存检查点数据。

继承
builtins.object
PartitionContext

构造函数

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

参数

名称 说明
fully_qualified_namespace
必需
eventhub_name
必需
consumer_group
必需
partition_id
必需
checkpoint_store
默认值: None

方法

update_checkpoint

将接收检查点汇报给定事件偏移量。

update_checkpoint

将接收检查点汇报给定事件偏移量。

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

参数

名称 说明
event

EventData 实例,其中包含用于检查点的偏移量和序列号信息。

默认值: None

返回

类型 说明

属性

last_enqueued_event_properties

最新的排队事件信息。

如果在创建接收方时将 track_last_enqueued_event_properties 设置为 True,则每次收到事件时都会更新此属性。 属性 dict 包括上一个排队事件的以下信息:

  • sequence_number (int)

  • offset (str)

  • enqueued_time (UTC datetime.datetime)

  • retrieval_time (UTC datetime.datetime)

返回

类型 说明
Dict[str, Any],