Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation based Spring Cloud Circuit breaker #84

Open
patpatpat123 opened this issue Nov 8, 2020 · 9 comments
Open

Annotation based Spring Cloud Circuit breaker #84

patpatpat123 opened this issue Nov 8, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@patpatpat123
Copy link

Is your feature request related to a problem? Please describe.
Problem: This project is amazing. However, currently, the application layer have to have code tied with the business logic to perform circuit breaker. The Spring Boot Starter Resilience4J project offers a very interesting set of annotations where methods can be annotated, and the decoration pattern will apply, making the code and understand of overall classes much clearer.

Describe the solution you'd like
A possibility to have annotations @CIRCUITBREAKER @Retry @timeout like Spring Boot Starter Resilience4J project, but for Spring-Cloud-CircuitBreaker. It is a very clean and nice feature

Describe alternatives you've considered
Well, right now, it is just a lot of code within the classes.

@ryanjbaxter
Copy link
Contributor

Could you not just use those annotations directly?

@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@patpatpat123
Copy link
Author

Hello @ryanjbaxter,

Just tried for the last couple of days.
Updated to the latest SpringBoot 2.4.1 with the latest Ilford M6, and the Spring Cloud Circuit Breaker.

It seems the annotations @timed @count etc... are just from

    <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-micrometer</artifactId>
        </dependency>
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-reactor</artifactId>
        </dependency>
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-spring-boot2</artifactId>
        </dependency>

The Spring Cloud Circuit breaker itself does not have the annotations (or am I using the wrong ones?)

And if I combine the jars (have the resilience4j ones and spring cloud circuit breaker, the resilience4j ones works, but yield the same behavior as if only resilience4j jars, with no circuit breaker).

@ryanjbaxter
Copy link
Contributor

If you are just going to use the Resilience4J annotations why would you include the spring cloud circuitbreaker jars?

@patpatpat123
Copy link
Author

That's pretty much the purpose of this request for enhancement 😅

Is it possible to use spring cloud circuit breaker jar, without resilience4j, but still have the annotations?

Currently, if I exclude resilience4j jars, just using spring cloud circuit breaker jars, there are no annotations at all (reason of this enhancement request)

@ryanjbaxter
Copy link
Contributor

Yeah not currently we dont have annotations. The topic has come up before, I thought there was already an issue open for this but I can't seem to find it, so maybe it was just conversations we have had.

Anyways we were waiting to see if there was enough demand from the community before actually adding any annotations.

@patpatpat123
Copy link
Author

many thanks! Hope to see it one day

@ryanjbaxter ryanjbaxter changed the title [Enhancement request (please)] Annotation based Spring Cloud Circuit breaker Annotation based Spring Cloud Circuit breaker Jan 4, 2021
@camproto
Copy link

camproto commented Mar 3, 2022

I would also vote for annottations. Auto-Wiring the CircuitBreakerFactory and the replace the original method with factory.create().run() code is repeating over and over again, especiall when your are coming from @HystrixCommand.
If you are going for an annotation, please add the configuration for all the exceptions (ignored) directly into the annotation and not in the application.properties, because this can cause easily refactoring issues (@hystrixCommand did this for ignored exceptions, good job!)

@mehdikhelif
Copy link

This would be definitively a great improvement. I think this would help a lot people who are migrating from hystrix-javanica.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants