spring-cloud / spring-cloud-circuitbreaker

Spring Cloud Circuit Breaker API and Implementations
Apache License 2.0
328 stars 109 forks source link

Add Support For Reactive Bulkheads #166

Open ryanjbaxter opened 1 year ago

ryanjbaxter commented 1 year ago

https://resilience4j.readme.io/docs/examples-1#decorate-mono-or-flux-with-a-bulkhead

omernaci commented 1 year ago

Hi @ryanjbaxter, I checked the link you shared.

I made an implementation for Mono in the Resilience4jBulkheadProvider class as follows. (I will do similar development in Flux) According to your comment, I can move forward on this task.

    public <T> Mono<T> decorateMono(String id, Map<String, String> tags, Mono<T> mono) {
        Resilience4jBulkheadConfigurationBuilder.BulkheadConfiguration configuration = configurations
                .computeIfAbsent(id, defaultConfiguration);
        Bulkhead bulkhead = getOrCreateBulkhead(id, configuration.getBulkheadConfig(), tags);
        return mono.transformDeferred(BulkheadOperator.of(bulkhead));
    }
ryanjbaxter commented 1 year ago

Sure PRs always welcome

omernaci commented 1 year ago

Hi @ryanjbaxter, The purpose of this annotation@ClassPathExclusions is an decoupling used to prevent conflicts between classes and to start the application faster? Resilience4JAutoConfigurationWithoutMetricsTest class contains the following "reactor-core-*.jar" definition for exclusion. Will removing "reactor-core-*.jar" parameter cause any side effect in the project?

ryanjbaxter commented 1 year ago

Its hard for me to say for sure as to why it is there. Likely to exclude some classes related to micrometer to make sure we are not depending on them and the autoconfiguration classes work properly. You can remove it and see if the test still works.

emilnkrastev commented 7 months ago

When can we expect the support for Reactive Bulkheads?