Closed MangKyu closed 1 year ago
Hey @MangKyu Could you give more information about the spring version and cloud version you are using?
I created a sample repository to understand more about your problem. As far as I can see it doesn't throw NoFallbackAvailableException. One more question from my side why do you want to throw an exception on fallback?
Feel free to add a commit or create a branch so I can check on that. https://github.com/cbezmen/can-feign/tree/b-MangKyu
@cbezmen hi can, Thanks for your kindness! I uploaded on my repository which is forked Because 403 forbidden occurs
It occurs when enable circuitbreaker by spring.cloud.openfeign.circuitbreaker.enabled
value as true.
Because there is no FeignClient`s fallback or fallbackFactory, FeignCircuitBreakerInvocationHandler.java runs with spring-cloud-commons CircuitBreaker interface which wraps exception by NoFallbackAvailableException
In my case, i have something like license code and if it fails to find, exception needs to be thrown.
Hey @MangKyu
I updated my branch. you can see diff via there or in here.
If you are using spring open feign, you shouldn't use @CircuitBreaker
. There is already an implementation for fallbacks. There is documentation in here. Spring open-feign checks for fallback implementation in the@FeignClient
annotation. If it is not implemented it will wrap it with NoFallbackAvailableException
.
Thanks for reply!
I should avoid using @CircuitBreaker
with Open Feign.
Thanks!
Describe the bug I cannot find any information whether it is intended, Exception is wrapped by NoFallbackAvailableException even using
@CircuitBreaker
fallbackMethodSample This is my
@FeignClient
with@CircuitBreaker
Then test below is passed
Also I can get an error logs with NoFallbackAvailableException (Some logs have been omitted.)
Since the fallbackmethod is specified, I don't think the error should be wrapped. But it is wrapped where it is called from FeignCircuitBreakerInvocationHandler.java
What I found is that, it is happend by calling fallbackMethod from resilence4J FallbackDecorators.
As Object with
@CircuitBreaker
is proxy and when resilence4J calls fallbackMethod By DefaultFallbackDecorator, FeignCircuitBreakerInvocationHandler.java is called and error is wrapped when fallback method is calledThanks for reading!