-
- 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.In case you call the
FtHandlerTyped.invokeMulti(java.util.function.Supplier)
method, the following restriction applies:- In case at least one record was sent (one
onNext
was called), the fallback will not trigger.
Multi
and aSingle
. If none is provided, the method is executed without fallback.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Fallback.Builder<T>
Fluent API builder forFallback
.
-
Method Summary
Static Methods Modifier and Type Method Description static <T> Fallback.Builder<T>
builder()
A builder to customizeFallback
.static <T> Fallback<T>
create(Function<Throwable,? extends CompletionStage<T>> fallback)
Create a fallback for aSingle
orCompletionStage
.static <T> Fallback<T>
createMulti(Function<Throwable,? extends Flow.Publisher<T>> fallback)
Create a fallback for aMulti
orFlow.Publisher
.-
Methods inherited from interface io.helidon.faulttolerance.FtHandlerTyped
invoke, invokeMulti
-
-
-
-
Method Detail
-
builder
static <T> Fallback.Builder<T> builder()
A builder to customizeFallback
.- Type Parameters:
T
- type of the values returned by the failing method- Returns:
- a new builder
-
create
static <T> Fallback<T> create(Function<Throwable,? extends CompletionStage<T>> fallback)
Create a fallback for aSingle
orCompletionStage
.- Type Parameters:
T
- type of the result- Parameters:
fallback
- fallback supplier to obtain the alternative result- Returns:
- a new fallback
-
createMulti
static <T> Fallback<T> createMulti(Function<Throwable,? extends Flow.Publisher<T>> fallback)
Create a fallback for aMulti
orFlow.Publisher
.- Type Parameters:
T
- type of the result- Parameters:
fallback
- fallback supplier to obtain the alternative result- Returns:
- a new fallback
-
-