-
Notifications
You must be signed in to change notification settings - Fork 788
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
Support circuit breaker configuration per Feign client #487
Comments
If you think this is a good idea, I might try to implement it. I just need some pointers how I would go about implementing that. |
I agree with @fdw. Configuration is difficult and error-prone. In Hystrix era we used It would be great if we could easily get the same with Spring Cloud Circuit Breaker/Resilience4j. class FeignCircuitBreakerInvocationHandler implements InvocationHandler {
...
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
...
String circuitName = Feign.configKey(target.type(), method); // allow to customize name
...
}
} My current small improvement for this issue is to display all possible circuit breaker names during app startup: @Bean
Capability customCapability() {
return new ConfigKeysPrintingCapability();
}
@Slf4j
public class ConfigKeysPrintingCapability implements Capability {
@Override
public InvocationHandlerFactory enrich(InvocationHandlerFactory invocationHandlerFactory) {
return (target, dispatch) -> {
Set<Method> keySet = dispatch.keySet();
for (Method method : keySet) {
log.info("Method key: {}", Feign.configKey(target.type(), method));
}
return invocationHandlerFactory.create(target, dispatch);
};
}
} |
Fixed by #575. Now we can use |
Is your feature request related to a problem? Please describe.
Currently, there seems to be no way to configure different circuit breakers for different Feign clients without listing all their methods.
I can either customize the default configuration, but then this configuration will be applied to all Feign clients. On the other hand, if I want to customize a specific configuration, I must do so for all its methods, as the circuit breaker name is
<feignClientName>-<methodName>
.Describe the solution you'd like
A simple solution would be to also check for a circuit breaker called
feignClientName
if no more specific one is found.An ideal solution would be similar to the other Feign configuration, i.e. I can specify a
Customizer
Bean in the Feign configuration, likeErrorDecoder
orRetryer
. This customizer would then be applied to just this Feign client.Describe alternatives you've considered
As I said, the current alternatives would be to list all methods in a client, which is quite error-prone.
The text was updated successfully, but these errors were encountered: