Reputation: 21
I am using Camel with Spring Boot and Micrometer. In one of my routes I am using a circuitbreaker with Resilience4j:
.circuitBreaker()
.resilience4jConfiguration()
.timeoutEnabled(true)
.timeoutDuration(2000)
.end()
I am using Micrometer managed by Spring. Before moving to resilience4j with Hystrix I could simply bind it to my Micrometer registry:
@Configuration()
public class MetricsRegistryBuilder {
@Bean
HystrixMetricsBinder registerHystrixMetricsBinder() {
return new HystrixMetricsBinder();
}
}
For Resilience4j there does not exist a binder unfortunately. There is some documentation about how to bind the Resilience4j CircuitBreakerRegistry to Micrometer: https://resilience4j.readme.io/docs/micrometer and also how to do it with Spring: https://resilience4j.readme.io/docs/getting-started-3
I tried to simply autowire the Resilience4j CircuitBreakerRegistry to Micrometer:
@Configuration()
public class MetricsRegistryBuilder {
@Autowired
private CircuitBreakerRegistry circuitBreakerRegistry;
}
Unfortunately Spring does not find the CircuitBreakerRegistry Bean.
Therefore my question is how to bind the CircuitBreakerRegistry, or more abstract the metrics from Resilience4j, to Micrometer when using Camel with Spring?
The only other possible solution I could think of is to manage all Resilience4j configuration manually, define the beans, and hand it over to my Camel configuration. This though seems to me to a lot of work and boilerplate code considering the simple task of binding my Resilience4j metrics.
I am using the following versions:
Also I am using camel spring boot starter dependencies:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-micrometer-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-resilience4j-starter</artifactId>
</dependency>
Upvotes: 2
Views: 1318
Reputation: 1907
Why can't you use our Spring Boot 2 Starter? The Starter autoconfigures the CircuitBreakerRegistry, MeterRegistry and allows external configuration.
Upvotes: 0