{smallrye-fault-tolerance} provides an API to integrate with event loops used in non-blocking runtimes.
Warning
|
This integration API comes from the core module and so is treated as private.
If you intend to implement it, please let us know in the {smallrye-fault-tolerance} issue tracker.
We’d prefer all the implementations to live in the {smallrye-fault-tolerance} project.
|
The integrator must implement the EventLoop
interface, which lets {smallrye-fault-tolerance} submit Runnable
s to the event loop for execution.
Implementations are discovered through ServiceLoader
, so the corresponding META-INF/services/...
file must also exist.
At most one implementation of EventLoop
may be present at runtime.
{smallrye-fault-tolerance} will use it to execute non-blocking guarded methods when the caller was originally on an event loop thread.
This is important in case of:
-
retries, when there’s a delay between retry attempts (the delay must not block);
-
bulkheads, when a task is queued (such task is executed when some other task finishes, which happens on an unknown thread).
If no event loop integration is present, the tasks described above will be offloaded to the thread pool.
{smallrye-fault-tolerance} includes an implementation of the event loop integration API for Vert.x. This implementation is compiled and tested against Vert.x version {vertx4-version}, but should also work fine with Vert.x 3.x.
This implementation is present in the io.smallrye:smallrye-fault-tolerance-vertx
artifact.
Including this artifact is enough to enable the Vert.x integration.
Note
|
The Vert.x implementation is treated as public, but only as described here. That is, the artifact should be treated as opaque, no guarantees about its internals are made. |