spring-cloud / spring-cloud-circuitbreaker

Spring Cloud Circuit Breaker API and Implementations
Apache License 2.0
329 stars 110 forks source link

Move import of resilience4j-bom up to spring-cloud-dependencies #91

Closed breun closed 3 years ago

breun commented 3 years ago

Currently spring-cloud-circuitbreaker-dependencies imports resilience4j-bom and manages its version. However, Resilience4J provides support for more than just circuit breakers and people might also want to be able to add a module like resilience4j-bulkhead or resilience4j-ratelimiter as managed in resilience4j-bom, but without using Spring Cloud Circuit Breaker. Wouldn't it therefor make sense to move the resilience4j-bom import and management of its version up to spring-cloud-dependencies?

ryanjbaxter commented 3 years ago

If you are not using Spring Cloud Circuitbreaker, then why not just manage the dependency yourself?

breun commented 3 years ago

Because it's one less version number to keep up to date, and managed dependencies are a big part of the benefits of the Spring Boot ecosystem. And since Spring Cloud Circuit Breaker is already managing this, why not provide it to non-circuit breaker users as well?

ryanjbaxter commented 3 years ago

It is not something Spring Cloud normally does. I will discuss it with the team.

breun commented 3 years ago

Maybe Spring Cloud Circuit Breaker should be expanded and rebranded to Spring Cloud Resilience and add support for more of the resilience patterns that Resilience4J supports, as suggested in https://github.com/spring-cloud/spring-cloud-circuitbreaker/issues/59.

spencergibb commented 3 years ago

so I just did a quick experiment. The spring-cloud-dependencies bom imports the circuitbreaker dependencies bom https://github.com/spring-cloud/spring-cloud-release/blob/master/spring-cloud-dependencies/pom.xml#L72

I created a simple project that imported spring-cloud-dependencies

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

and was able to add

<dependency>
    <groupId>io.github.resilience4j</groupId>
    <artifactId>resilience4j-bulkhead</artifactId>
</dependency>

without a version and without error and use SemaphoreBulkhead in a project.

SemaphoreBulkhead semaphoreBulkhead = new SemaphoreBulkhead("mybulkhead");

So I think it already works

ryanjbaxter commented 3 years ago

Thanks @spencergibb! I will close this or now since it seems doable.

breun commented 3 years ago

Ah great, I missed that, thanks!