[[MicroProfile-Fault-Tolerance-SmallRye]]
= MicroProfile Fault Tolerance Subsystem

== Specification

WildFly's MicroProfile Fault Tolerance subsystem implements MicroProfile Fault Tolerance 4.0.

This MicroProfile specification provides the following interceptor bindings:

* `@Timeout` to define a maximum duration or an execution.
* `@Retry` to attempt execution again in case of a failure.
* `@Fallback`  to provide an alternative execution in case of a prior failure.
* `@CircuitBreaker` to automatically fail-fast when an execution repeatedly fails.
* `@Bulkhead` to limit concurrent executions so that one method doesn't overload the entire system.
* `@Asynchronous` to execute a method asynchronously.

For complete documentation please refer to MicroProfile Fault Tolerance 4.0 https://download.eclipse.org/microprofile/microprofile-fault-tolerance-4.0/microprofile-fault-tolerance-spec-4.0.html[specification].

Support for https://microprofile.io/project/eclipse/microprofile-fault-tolerance[MicroProfile Fault Tolerance] is
provided as by the `microprofile-fault-tolerance-smallrye` subsystem.

The MicroProfile Fault Tolerance implementation is provided by the https://github.com/smallrye/smallrye-fault-tolerance[SmallRye Fault Tolerance] project.


[[required-extension-microprofile-fault-tolerance-smallrye]]
== Required Extension

This extension is automatically included in the `standalone-microprofile` server profiles,
however, it is not included by default in the default configuration of WildFly.

NOTE: The MicroProfile Metrics extension and subsystem are required by this extension,
please follow the instructions in the <<required-extension-microprofile-metrics-smallrye,MicroProfile Metrics Subsystem Configuration section>>.

You can add the extension to a configuration without it either by using the following CLI operations:

[source,options="nowrap"]
----
[standalone@localhost:9990 /] /extension=org.wildfly.extension.microprofile.fault-tolerance-smallrye:add
{"outcome" => "success"}

[standalone@localhost:9990 /] /subsystem=microprofile-fault-tolerance-smallrye:add
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}
[standalone@localhost:9990 /] reload
----

Or by adding an element to the application server profile XML to `<extensions>` section:

[source,xml,options="nowrap"]
----
<extension module="org.wildfly.extension.microprofile.fault-tolerance-smallrye"/>
----

and then the subsystem in the `<profile>` section:

[source,xml,options="nowrap"]
----
<subsystem xmlns="urn:wildfly:microprofile-fault-tolerance-smallrye:1.0"/>
----

The subsystem itself does not have any configurable elements.


== Configuration

Apart from configuration properties defined by the specification, the SmallRye implementation provides the following
configuration properties:

.SmallRye Fault Tolerance configuration properties
|===
|Name |Default |Description

|`io.smallrye.faulttolerance.mainThreadPoolSize`
|`100`
|Maximum number of threads in the thread pool.

|`io.smallrye.faulttolerance.mainThreadPoolQueueSize`
|`-1` (unbounded)
|Size of the queue that the thread pool should use.

|===
