【问题标题】:The constructor SeekToCurrentErrorHandler(int) is undefined for type int对于 int 类型,构造函数 SeekToCurrentErrorHandler(int) 未定义
【发布时间】:2022-01-06 02:24:04
【问题描述】:

SeekToCurrentHandler(int) 现在在 kafka 版本 2.7.8 中不接受 对于 int 类型,构造函数 SeekToCurrentErrorHandler(int) 未定义 应该有什么替代方法?

ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.getContainerProperties().setAckMode(AckMode.MANUAL_IMMEDIATE);
factory.setErrorHandler(new SeekToCurrentErrorHandler(maxFailures));
factory.setConcurrency(afConsumerConcurrencyLevel);

【问题讨论】:

    标签: apache-kafka spring-kafka


    【解决方案1】:
    factory.setErrorHandler(new SeekToCurrentErrorHandler(new FixedBackOff(0L, maxFailures - 1)));
    

    这将重试传送最多maxFailures - 1 次(最大失败传送尝试次数),后退时间为 0 秒,而不是默认配置 (FixedBackOff(0L, 9))。失败只是在重试用尽后记录。

    https://docs.spring.io/spring-kafka/docs/2.7.8/reference/html/#seek-to-current

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多