About
Fault Tolerance means your microservice can handle failures in a graceful way. MicroProfile Fault Tolerance helps you define and handle problems in a consistent and robust manner.
Martin Stefanko's cheat sheet includes:
- Defining Timeouts, Retries, Circuit Breakers, and more
- Configuring your environment, including default values
- Disabling individual policies, e.g. turn off a Circuit Breakers
- Using a Fallback method
Excerpt
@CircuitBreaker
A Circuit Breaker prevents repeated failures, so that dysfunctional services
or APIs fail fast.
@Fallback
fallbackMethod must be in the same class as @Fallback annotated
method. In order to recover from a brief network glitch, @Retry can be used to invoke
the same operation again.
A Fallback method is invoked if a method annotated with @Fallback completes exceptionally.
@Timeout(4000)