EventProcessorClient - AmqpRetryOptions 选项行为

EventProcessorClient - AmqpRetryOptions options behaviour

这是我们当前的场景 - 监听给定事件中心上的所有分区,并根据内容逻辑处理每条消息,如果内部初始处理失败。

遵循更高吞吐量的建议指南,我们计划使用 EventProcessorClient(Azure SDK 用于使用来自 Azure 事件中心的事件。使用 EventProcessorClientBuilder,它根据文档进行了初始化。

 EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder()
     .consumerGroup("consumer-group")
     .checkpointStore(new BlobCheckpointStore(blobContainerAsyncClient))
     .processEvent(eventContext -> {
         // process eventData and throw error if the internal logic fails
      })
     .processError(errorContext -> {
         System.out.printf("Error occurred in partition processor for partition {}, {}",
             errorContext.getPartitionContext().getPartitionId(),
             errorContext.getThrowable());
     })
     .connectionString(connectionString)
     .retry(new AmqpRetryOptions()
        .setMaxRetries(3).setMode(AmqpRetryMode.FIXED).setDelay(Duration.ofSeconds(120)))
     .buildEventProcessorClient();
eventProcessorClient.start();

但是,重试逻辑根本没有启动,进一步检查 documentation - 我想知道这是否仅适用于 EventHubAsyncClient 的显式实例。关于实现此重试功能所需的任何建议或意见? 提前致谢。

re-process (until configured no. of times - say 3) the same event if the initial processing fails internally.

这不是处理器重试的方式。 AmqpRetryOptions 控制客户端将重试服务操作(也称为使用 AMQP 协议的操作)的次数,例如从分区读取。

处理器交付事件后,您的应用程序负责处理它们的代码 - 包括错误处理和重试。

这是因为 EventProcessorClient 对您的应用程序代码和场景没有足够的了解,无法确定面对异常时应采取的正确操作。例如,它无法知道处理是否有状态、是否已损坏或是否可以安全重试。