首页 > 解决方案 > 骆驼resilience4j断路器

问题描述

我想使用resilience4j 框架来实现容错。我已经为 resilence4j 使用了骆驼默认配置。该路由从 kafka 主题订阅消息并发送到 http 端点。

如果 http 端点关闭,它会尝试几次并进入 OPEN 状态。当 http 端点关闭时,它永远不会进入半开或关闭状态。如果我缺少任何东西,请帮助我。下面是我用于骆驼路线的代码片段。

from("kafka:{{ice.kafka.topics.goe.trades}}?brokers=localhost:9092&autoOffsetReset= 
{{ice.kafka.auto.offset.reset}}&autoCommitEnable=true&allowManualCommit=false")
            .log("Kafka input ${body}")
            .circuitBreaker().inheritErrorHandler(true)
            .resilience4jConfiguration()
            .timeoutEnabled(true).timeoutDuration(50000).writableStackTraceEnabled(true).end()
            .log("before Resilience ${threadName}").log("${headers}")
            .toD("http://localhost:8083/student/allstudent?httpMethod=GET")
            .log("After Resilience ${threadName}")
            ;

标签: apache-camelresilience4j

解决方案


推荐阅读