Eclipse MicroProfile Fault Tolerance API
Since 4.1.2.181; 5.181
Provided version of the API: MicroProfile Fault Tolerance 1.0
Background
The Fault Tolerance API was created to help separate execution logic from execution. The execution can be configured with a number of fault tolerance policies.
A full overview for the reasoning behind the API can be found in the README for the source code repository.
The complete specification is maintained in the same repository
Additions to the Fault Tolerance Spec
In addition to the functionality detailed in the spec, the following is also implemented in Payara Server and Payara Micro:
Configurable Managed Executor Services
The managed and scheduled managed executor pool can be configured via the set-fault-tolerance-configuration asadmin command.
The managed executor service is used to execute methods annotated with @Asynchronous, whereas the managed scheduled executor service is used by the CircuitBreaker and Timeout interceptors for their timeout operations (scheduling the circuit breaker to be set to half open, and just timing out respectively).
Annotation Priority
The order that the fault tolerance annotations are invoked is as follows:
-
Fallback (SPECIAL CASE - you’ll ONLY get here if there is an exception kicking off the asynchronous thread)
-
Asynchronous
-
Fallback
-
Retry
-
Bulkhead
-
CircuitBreaker
-
Timeout
Since the asynchronous annotation is invoked first, if it’s combined with any other fault tolerance annotations they will be processed on the asynchronous thread.
Asadmin Commands
set-fault-tolerance-configuration
- Usage
-
asadmin> set-fault-tolerance-configuration [--managedexecutorservicename=<managedexecutorservicename>] [--managedscheduledexecutorservicename=<managedscheduledexecutorservicename>] [--target=<server-config>]
- Aim
-
Provides a way to set the configuration of the fault tolerance service of the targetted config.
Command Options
Option | Description | Default | Mandatory |
---|---|---|---|
|
The JNDI name of the Managed Executor Service to look up. |
"" (concurrent/__defaultManagedExecutorService) |
no |
|
The JNDI name of the Managed Scheduled Executor Service to look up. |
"" (concurrent/__defaultManagedScheduledExecutorService) |
no |
|
The target Payara config to apply the change to |
server (the DAS) |
no |
get-fault-tolerance-configuration
- Usage
-
asadmin> get-fault-tolerance-configuration [--target=server-config]
- Aim
-
Returns the current configuration options for the Fault Tolerance service on the targetted config.