问题描述
我正在通过EventHubConsumerClient类上的receiveFromPartition方法从Azure EventHub群集同步读取事件。
我曾经这样创建客户端:
EventHubConsumerClient eventHubConsumerClient = new EventHubClientBuilder()
.connectionString(eventHubConnectionString)
.consumerGroup(consumerGroup)
.buildConsumerClient());
然后我仅使用scheduledexecutorservice通过以下方式每1.5秒检索一次事件:
IterableStream<PartitionEvent> receivedEvents = eventHubConsumerClient.receiveFromPartition(
partitionId,1,eventPosition);
我一直在生产中使用SDK的V3运行类似的逻辑,但是没有问题,但是升级到V5之后,我遇到了问题。
当我启动此循环时,所有功能似乎都工作正常,但是成功执行40分钟左右后,EventHubConsumerClient应请求开始超时(等待2分钟后),即使EventHub实例中肯定有新数据可用
相应日志的一个小例子:
com.azure.core.amqp.implementation.RetryUtil: TimeoutException error occurred. retrying operation.
com.azure.messaging.eventhubs.implementation.SynchronousEventSubscriber$ReceiveTimeoutTask: Work: 5. Timeout encountered,disposing of subscriber.
这是一个错误,还是这样的连接在新的SDK版本中可以保留多长时间?如果是这样,如何确保我可以依靠的长期连接?
任何建议将不胜感激,谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)