Ok so I couldn't find any helpful materials on this topic, a big chunk of articles I found had one method that was annotated with @HystrixCommand and had defined a fallback method.
The other solution I found was using @DefaultProperties(defaultFallback = "fallbackMethod") but the problem with this is that the methods need to have compatible return types.
Unfortunately for me in my service I have many methods with completely different signatures and also I need to get hold of the throwable (in docs it is mentioned that you cannot have any parameters for a default fallback method). The methods look something like this:
@Service
@RequiredArgsConstructor
public class MyService {
private final FeignClient feignClient;
@Override
public String methodA(final CustomObjectA o, final String entity) {
...
}
@Override
public String methodB(final String collection, final Map<String, Object> requestBody) {
...
}
@Override
public String methodC(final String collection, final String id, final Map<String, Object> requestBody) {
...
}
}
And ofc I have more than 3 methods def in the service...
The thing I really want to avoid is making 20 hystrix default fallback methods.
Is there a way where I could def a standard fallback for all methods, no matter what the signatures they have, or am I stuck with defining a fallback method for every single method?
Thanks in advance!!