Interface MutinyFaultTolerance


  • public interface MutinyFaultTolerance
    Contains factory methods for FaultTolerance where the type of value of the guarded action is a Mutiny Uni. These actions are always asynchronous and may be offloaded to another thread if necessary. In a modern reactive architecture, which is a typical use case for Mutiny, the actions are non-blocking and thread offload is not necessary.

    Note that Uni is a lazy type, so the guarded actions are not called until the guarded Uni is subscribed to.

    • Method Detail

      • createCallable

        static <T> FaultTolerance.Builder<io.smallrye.mutiny.Uni<T>,​Callable<io.smallrye.mutiny.Uni<T>>> createCallable​(Callable<io.smallrye.mutiny.Uni<T>> action)
        Returns a builder that, at the end, returns a Callable guarding the given action. The action is asynchronous and may be offloaded to another thread.

        Note that Uni is a lazy type, so the action itself won't execute until the Uni obtained from the resulting Callable is subscribed to.

      • createSupplier

        static <T> FaultTolerance.Builder<io.smallrye.mutiny.Uni<T>,​Supplier<io.smallrye.mutiny.Uni<T>>> createSupplier​(Supplier<io.smallrye.mutiny.Uni<T>> action)
        Returns a builder that, at the end, returns a Supplier guarding the given action. The action is asynchronous and may be offloaded to another thread.

        Note that Uni is a lazy type, so the action itself won't execute until the Uni obtained from the resulting Supplier is subscribed to.

      • create

        static <T> FaultTolerance.Builder<io.smallrye.mutiny.Uni<T>,​FaultTolerance<io.smallrye.mutiny.Uni<T>>> create()
        Returns a builder that, at the end, returns a FaultTolerance object representing a set of configured fault tolerance strategies. It can be used to execute asynchronous actions using FaultTolerance.call(Callable) or FaultTolerance.get(Supplier).

        Note that Uni is a lazy type, so the action itself won't execute until the Uni returned from the call or get methods is subscribed to. For this reason, using FaultTolerance.run(Runnable) doesn't make sense, because there's no way to obtain the resulting Uni that would need subscribing.

        This method usually has to be called with an explicitly provided type argument. For example: MutinyFaultTolerance.&lt;String>create().