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
Feature: Combine circuit breakers with TimeLimiter in Spring boot #430
Comments
We implemented a Threadpool based Bulkhead with a bounded queue which can easily be combined with a TimeLimiter in the future. |
Hi @RobWin , Thanks for your attention. |
Sure you can. Just use your own Executorservice or CompletableFuture. |
But anyway we can add a new TimeLimiter Annotation. |
For now I need more time to do it, but I don't have, when I am available in the next months and it have not been done yet, I can try doing it. |
Can you invoke |
Trying to piggyback on the timelimiter topic rather than creating a new issue here - is there any reason that the time limiter module is not imported by default for the spring module? I would expect that to be the given how it's called a core module. |
Yes, there are no additional Spring Boot features yet. First we need to create an Aspect which supports Reactor and RxJava as well. Shouldn't be too difficult, but nevertheless we need some time. A PR is welcome :) |
Anyone interested in contributing this feature? |
I'll work on this issue. |
Any updates regarding this feature support? @dlsrb6342 are you still going to contribute this feature? |
@liorsamuni |
I'm interested in this as well. @dlsrb6342 are you still planning to work on it? EDIT: Oh sorry, I see that you just answered this question about 2 weeks ago. I might be able to look into it. Any pointers on getting started? I've never been in this code base before. |
@ericwyles As @RobWin commented, we need to create an Aspect which supports Reactor and RxJava. |
Merged 🎉 |
The Spring Boot 2 demo shows how to use the Resilience4j annotations -> https://github.com/resilience4j/resilience4j-spring-boot2-demo/blob/master/src/main/java/io/github/robwin/service/BackendAService.java#L141-L148 The TimeLimiter annotations can be used for CompletableFuture, CompletionStage, Spring Reactor, RxJava2. |
Great news!!! Thanks a lot, I will notify my team about this feature!!! |
Thank you all for completing this! I will notify my team as well. |
It's not released yet. Maybe tomorrow |
v.1.3.0 has been released. Maven Central Sync might take some time. |
@RobWin , I am using @Timelimiter(name = "service1", fallbackMethod = "service1Fallback") independently on a method without @circuitbreaker/bulkhead etc. |
What is the return type of your method? |
return type is a pojo. Let's me define a custom example of my scenario. `class Test{ default SalesResponse service1Fallback(String id, Throwable t){ |
You can only use TimeLimiter with CompletableFuture, Reactor or RxJava2 return types. |
Why is timeLimiter not extended to plain objects like other annotation? Also, is there any way to leverage this feature in my scenario? |
Because a Timelimiter can only interrupt the execution and return an exception, if it is not running in the same thread. |
Thanks for the answer! |
Thanks for last pointer, this helped. I was getting IllegalArgument exception till then. CompletableFuture solved the issue |
@RobWin Here is the piece of code on which I am trying to implement @Timelimiter:
Here is the application.yml file:
But the time limiter is not working. Can you please tell, what I am doing wrong? |
@RobWin e @akhil-gupta01 it is happing the same with me.
My configuration
When I call myClass.perform, this method spend more than 3s, but the timelimiter does not "interrupt" the operation. |
@charlesardsilva @akhil-gupta01 The TimeLimiter or CircuitBreaker do not run a Task in a Threadpool. You either have to combine the Timelimiter with |
Hi @RobWin , thanks for your help! It's worked. |
@RobWin using |
No, you can't limit the time of your current running Thread. You have to spawn the task in another thread in order to limit the execution time. That's why you can't combine a TimeLimiter with a sync method signature. |
Yeah, it makes sense, of course, that you cannot limit the time of the current running Thread. Your previous answer suggested that combining I guess I will just implement timeouts on my |
yes |
This is a request for adding a feature in resilience4j.
The project could have integration between "CircuitBreaker" and "TimeLimiter" using annotation in Spring Boot project.
Hystrix there is a configuration in @HystrixCommand that allows us to set timeout to desired operation.
I understood that is possible configure CircuitBreaker and TimeLimiter only using expression.
The text was updated successfully, but these errors were encountered: