Package com.koralix.stepfn
Class AsyncStepFunction<T,R>
java.lang.Object
com.koralix.stepfn.StepFunction<T,R,CompletableFuture<R>>
com.koralix.stepfn.AsyncStepFunction<T,R>
- Type Parameters:
T- the type of the input to the functionR- the type of the result of the function
- All Implemented Interfaces:
Function<T,CompletableFuture<R>>
A
StepFunction that returns a CompletableFuture.
The function is applied asynchronously using the Executor provided to the constructor.
Check the StepFunction documentation for more information and examples.
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncStepFunction(Step<T, ?> initialStep, Supplier<ExecutorService> executorSupplier) Creates a newAsyncStepFunctionwith the given initial step.AsyncStepFunction(Step<T, ?> initialStep, Map<Step<?, ?>, Set<Transition<?, ?>>> transitions, Supplier<ExecutorService> executorSupplier) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionApplies this function to the given argument.protected <A,B> Optional<CompletableFuture<B>> Applies the givenStepto the given input.Methods inherited from class com.koralix.stepfn.StepFunction
addTransition, addTransition, apply, firstStep, transitions
-
Constructor Details
-
AsyncStepFunction
@Deprecated public AsyncStepFunction(Step<T, ?> initialStep, Map<Step<?, ?>, Set<Transition<?, ?>>> transitions, Supplier<ExecutorService> executorSupplier) Deprecated.useAsyncStepFunction(Step, Supplier)instead - this constructor will be removed in 1.2.0Creates a newAsyncStepFunctionwith the given initial step and transitions.- Parameters:
initialStep- the initial steptransitions- the transitionsexecutorSupplier- the supplier of the executor to use for asynchronous computation- Since:
- 1.0.0
-
AsyncStepFunction
Creates a newAsyncStepFunctionwith the given initial step.- Parameters:
initialStep- the initial stepexecutorSupplier- the supplier of the executor to use for asynchronous computation- Since:
- 1.0.0
-
-
Method Details
-
apply
Applies this function to the given argument.- Parameters:
t- the function argument- Returns:
- the function result in a
CompletableFuture - Since:
- 1.0.0
-
step
Applies the givenStepto the given input.If the
Stepis complete, the result is returned in aCompletableFuture.If the step is not complete, an empty
Optionalis returned and the input is aggregated.- Specified by:
stepin classStepFunction<T,R, CompletableFuture<R>> - Type Parameters:
A- the input type of the stepB- the output type of the step- Parameters:
step- the step to applyfrom- the step from which the input was receivedinput- the input to the step- Returns:
- the result of the step in a
CompletableFutureif the step is complete, an emptyOptionalotherwise - Since:
- 1.0.0
-
AsyncStepFunction(Step, Supplier)instead - this constructor will be removed in 1.2.0