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
Add fallback strategy to CircuitBreakerClient #4818
Conversation
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClientBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClientHandler.java
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClientBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClientBuilder.java
Outdated
Show resolved
Hide resolved
@ikhoon : Thank you for your advice! I've added the recover method to CircuitBreakerRpcClientBuilder and applied your advice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly, looks good.
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
...ain/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClientBuilder.java
Show resolved
Hide resolved
...ain/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClientBuilder.java
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClient.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClientBuilder.java
Outdated
Show resolved
Hide resolved
@ikhoon : Thanks, I've applied all of your advice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @my4-dev! Left minor comments about annotations.
...ain/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClientBuilder.java
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClientBuilder.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClientBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/AbstractCircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
Thanks for reviewing. I fixed it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 Thanks @my4-dev 🙇 👍 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Left some nits. 😄
this.fallback = fallback; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MoreObjects.toStringHelper(this).omitNullValues() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We also need to add fallback
to this method.
Or we can just remove toString()
method of builders, which I prefer. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString()
method is removed.
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClient.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerClientBuilder.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClientBuilder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, @my4-dev! 👍 🙇
Thanks, again @my4-dev! |
Motivation:
Described in #4800
Modifications:
recover
method toCircuitBreakerClientBuilder
in order to set a fallback logic via a builder methodCircuitBreakerClientHandler
to check which exception is a circuit breaker exceptionResult:
CircuitBreakerClient
#4800