Interface Fallback<T>

Type Parameters:
T - type of the values returned
All Superinterfaces:
FtHandlerTyped<T>

public interface Fallback<T> extends FtHandlerTyped<T>
Fallback allows the user to execute an alternative function in case the provided supplier fails.
  • Method Details

    • create

      static <T> Fallback<T> create(FallbackConfig<T> fallbackConfig)
      Create a fallback based on configuration.
      Type Parameters:
      T - type of the values returned by the failing method
      Parameters:
      fallbackConfig - fallback configuration
      Returns:
      a new fallback
    • create

      static <T> Fallback<T> create(Consumer<FallbackConfig.Builder<T>> configConsumer)
      Create a fallback and customize its configuration.
      Type Parameters:
      T - type of the values returned by the failing method
      Parameters:
      configConsumer - consumer of configuration
      Returns:
      a new fallback
    • createFromMethod

      static <T> Fallback<T> createFromMethod(Function<Throwable,? extends T> method)
      Create a fallback from the fallback method.
      Type Parameters:
      T - fallback method return type
      Parameters:
      method - method to use
      Returns:
      a new fallback