什么是与 EPHOptions.keep_alive_interval 等效的 Azure Eventhub Python SDK v5.x.x,它是 v1.x.x 的一部分

问题描述

我一直在将 Python Eventthub SDK 从 v1 迁移到 v5。 由于 EPHOptions 在新版本中已弃用。我将无法在 v5.x.x 中使用它

我想使用 EPHOptions.keep_alive_interval,它在 Python Eventhub SDK v5.x.x 中的等价物是什么?

解决方法

目前 V5.x.x SDK 中没有等效的类。

在 V1 中,EventProcessorHost 允许您平衡之间的负载 接收事件时程序的多个实例。

在 V5 中,EventHubConsumerClient 允许您对 如果您将 CheckpointStore 传递给构造函数,那么 receive() 方法。

在 V5 中,您需要使用 EventHubConsumerClient 来接收事件。但是没有设置keep_alive_interval的参数。

参考:

https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventhub/azure-eventhub/migration_guide.md#migrating-code-from-eventprocessorhost-to-eventhubconsumerclient-for-receiving-events

https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer_client.py

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...