包含/排除骆驼弹性中的异常4J

问题描述

在骆驼路线(spring-boot应用程序)中使用resilience4J库实现断路器模式时,如何在分析中包括/排除异常。

我们正在使用以下官方库,但是它没有公开任何API来排除普通Java库之类的例外。

    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-resilience4j-starter</artifactId>
        <version>${camel.version}</version>
    </dependency>

,但是官方文档说有API可以处理以下情况: https://resilience4j.readme.io/docs/circuitbreaker

// Create a custom configuration for a CircuitBreaker
CircuitBreakerConfig circuitBreakerConfig = CircuitBreakerConfig.custom()
  .failureRateThreshold(50)
  .slowCallRateThreshold(50)
  .waitDurationInOpenState(Duration.ofMillis(1000))
  .slowCallDurationThreshold(Duration.ofSeconds(2))
  .permittedNumberOfCallsInHalfOpenState(3)
  .minimumNumberOfCalls(10)
  .slidingWindowType(SlidingWindowType.TIME_BASED)
  .slidingWindowSize(5)
  .recordException(e -> INTERNAL_SERVER_ERROR
                 .equals(getResponse().getStatus()))
  .recordExceptions(IOException.class,TimeoutException.class)
  .ignoreExceptions(BusinessException.class,OtherBusinessException.class)
  .build();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

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