【问题标题】:how to log the reason for resilience4j fallback in camel route如何在骆驼路线中记录 resilience4j 回退的原因
【发布时间】:2023-02-22 23:09:13
【问题描述】:

在 resilience4j 配置中,我同时具有断路器、隔板和线程超时的参数。一旦发生回退,我就无法找出导致回退的原因。我正在骆驼路线中实施resilience4j配置。

【问题讨论】:

    标签: apache-camel


    【解决方案1】:

    你不能混合 onFallback 和 Exception,使用 story() 和 throwException WhenHalfOpenOrOpenState(true) 配置:

    .doTry()
      .circuitBreaker()
        .resilience4jConfiguration()
            .throwExceptionWhenHalfOpenOrOpenState(true)
         .end()
         .to("http://fooservice.com/faulty")
        .end()
      .endDoTry()
      .doCatch(Exception.class)
         .log("${exception.message}")
      .end
    

    【讨论】:

      猜你喜欢
      • 2011-05-24
      • 2015-06-12
      • 1970-01-01
      • 1970-01-01
      • 2018-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多