T - the feign interface typepublic interface FallbackFactory<T>
// This instance will be invoked if there are errors of any kind.
FallbackFactory<GitHub> fallbackFactory = cause -> (owner, repo) -> {
if (cause instanceof FeignException && ((FeignException) cause).status() == 403) {
return Collections.emptyList();
} else {
return Arrays.asList("yogi");
}
};
GitHub github = HystrixFeign.builder()
...
.target(GitHub.class, "https://api.github.com", fallbackFactory);
| Modifier and Type | Interface and Description |
|---|---|
static class |
FallbackFactory.Default<T>
Returns a constant fallback after logging the cause to FINE level.
|
| Modifier and Type | Method and Description |
|---|---|
T |
create(Throwable cause)
Returns an instance of the fallback appropriate for the given cause
|
T create(Throwable cause)
cause - corresponds to AbstractCommand.getExecutionException()
often, but not always an instance of FeignException.Copyright © 2012–2018 OpenFeign. All rights reserved.