Share via


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

EventProcessor<TPartition>.GetCheckpointAsync 方法

定义

返回事件中心、使用者组以及与事件处理程序实例关联的分区的标识符的检查点,以便可以正确初始化给定分区的处理。 默认实现调用 并 Azure.Messaging.EventHubs.Primitives.EventProcessor`1.ListCheckpointsAsync(System.Threading.CancellationToken)PartitionId筛选结果。 建议在实现中 EventProcessor<TPartition> 重写此方法,以实现最佳性能。

protected virtual System.Threading.Tasks.Task<Azure.Messaging.EventHubs.Primitives.EventProcessorCheckpoint> GetCheckpointAsync (string partitionId, System.Threading.CancellationToken cancellationToken);
abstract member GetCheckpointAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Messaging.EventHubs.Primitives.EventProcessorCheckpoint>
override this.GetCheckpointAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Messaging.EventHubs.Primitives.EventProcessorCheckpoint>
Protected Overridable Function GetCheckpointAsync (partitionId As String, cancellationToken As CancellationToken) As Task(Of EventProcessorCheckpoint)

参数

partitionId
String

要检索其检查点的分区的标识符。

cancellationToken
CancellationToken

一个 CancellationToken 实例,用于向请求发出取消处理信号。 当处理器关闭时,最有可能发生这种情况。

返回

初始化分区时要考虑的处理器检查点。

注解

如果分区没有相应的检查点, DefaultStartingPosition 则将使用 初始化分区进行处理。

如果单个分区需要自定义起点,或者每个分区应从一个唯一位置开始,则建议此方法通过返回设置了所需自定义起始位置的这些分区的检查点来表达该意图。

适用于