Interface DurableContext
- All Superinterfaces:
BaseContext
- All Known Implementing Classes:
DurableContextImpl
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceFunction applied to each item in a map operation. -
Field Summary
Fields inherited from interface software.amazon.lambda.durable.context.BaseContext
CONTEXT -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> DurableCallbackFuture<T>createCallback(String name, Class<T> resultType) Creates a callback with default configuration.default <T> DurableCallbackFuture<T>createCallback(String name, Class<T> resultType, CallbackConfig config) Creates a callback with custom configuration.default <T> DurableCallbackFuture<T>createCallback(String name, TypeToken<T> resultType) Creates a callback using aTypeTokenfor generic result types.<T> DurableCallbackFuture<T>createCallback(String name, TypeToken<T> resultType, CallbackConfig config) Creates a callback operation that suspends execution until an external system completes it.static DurableContextGets the current context (DurableContext or StepContext) for this thread.default <T,U> T Invokes another Lambda function by name and blocks until the result is available.default <T,U> T invoke(String name, String functionName, U payload, Class<T> resultType, InvokeConfig config) Invokes another Lambda function with custom configuration, blocking until the result is available.default <T,U> T Invokes another Lambda function using aTypeTokenfor generic result types, blocking until complete.default <T,U> T invoke(String name, String functionName, U payload, TypeToken<T> resultType, InvokeConfig config) Invokes another Lambda function using aTypeTokenand custom configuration, blocking until complete.default <T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, Class<T> resultType) Asynchronously invokes another Lambda function, returning aDurableFuture.default <T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, Class<T> resultType, InvokeConfig config) Invokes another Lambda function using aTypeTokenand custom configuration, blocking until complete.default <T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, TypeToken<T> resultType) Asynchronously invokes another Lambda function using aTypeTokenfor generic result types.<T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, TypeToken<T> resultType, InvokeConfig config) Asynchronously invokes another Lambda function using aTypeTokenand custom configuration.booleanReturns whether this context is currently replaying checkpointed durable operations.default <I,O> MapResult<O> map(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function) default <I,O> MapResult<O> map(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) default <I,O> MapResult<O> map(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function) default <I,O> MapResult<O> map(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) default <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function) default <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) default <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function) <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) default ParallelDurableFutureCreates aParallelDurableFuturefor executing multiple branches concurrently with default configparallel(String name, ParallelConfig config) Creates aParallelDurableFuturefor executing multiple branches concurrently.default <T> TrunInChildContext(String name, Class<T> resultType, Function<DurableContext, T> func) Runs a function in a child context, blocking until it completes.default <T> TrunInChildContext(String name, Class<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.default <T> TrunInChildContext(String name, TypeToken<T> resultType, Function<DurableContext, T> func) Runs a function in a child context using aTypeTokenfor generic result types, blocking until complete.default <T> TrunInChildContext(String name, TypeToken<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.default <T> DurableFuture<T>runInChildContextAsync(String name, Class<T> resultType, Function<DurableContext, T> func) Runs a function in a child context, blocking until it completes.default <T> DurableFuture<T>runInChildContextAsync(String name, Class<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.default <T> DurableFuture<T>runInChildContextAsync(String name, TypeToken<T> resultType, Function<DurableContext, T> func) Runs a function in a child context, blocking until it completes.<T> DurableFuture<T>runInChildContextAsync(String name, TypeToken<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.default <T> Tstep(String name, Class<T> resultType, Function<StepContext, T> func) Executes a durable step with the given name and blocks until it completes.default <T> Tstep(String name, Class<T> resultType, Function<StepContext, T> func, StepConfig config) Executes a durable step with the given name and configuration, blocking until it completes.default <T> TDeprecated.use the variants accepting StepContext insteaddefault <T> Tstep(String name, Class<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext insteaddefault <T> Tstep(String name, TypeToken<T> resultType, Function<StepContext, T> func) Executes a durable step using aTypeTokenfor generic result types, blocking until it completes.default <T> Tstep(String name, TypeToken<T> resultType, Function<StepContext, T> func, StepConfig config) Executes a durable step using aTypeTokenand configuration, blocking until it completes.default <T> TDeprecated.use the variants accepting StepContext insteaddefault <T> Tstep(String name, TypeToken<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext insteaddefault <T> DurableFuture<T>stepAsync(String name, Class<T> resultType, Function<StepContext, T> func) Asynchronously executes a durable step, returning aDurableFuturethat can be composed or blocked on.default <T> DurableFuture<T>stepAsync(String name, Class<T> resultType, Function<StepContext, T> func, StepConfig config) Asynchronously executes a durable step using custom configuration.default <T> DurableFuture<T>Deprecated.use the variants accepting StepContext insteaddefault <T> DurableFuture<T>stepAsync(String name, Class<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext insteaddefault <T> DurableFuture<T>stepAsync(String name, TypeToken<T> resultType, Function<StepContext, T> func) Asynchronously executes a durable step using aTypeTokenfor generic result types.<T> DurableFuture<T>stepAsync(String name, TypeToken<T> resultType, Function<StepContext, T> func, StepConfig config) Asynchronously executes a durable step using aTypeTokenand custom configuration.default <T> DurableFuture<T>Deprecated.use the variants accepting StepContext insteaddefault <T> DurableFuture<T>stepAsync(String name, TypeToken<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext insteaddefault VoidSuspends execution for the specified duration without consuming compute resources.Asynchronously suspends execution for the specified duration.default <T> TwaitForCallback(String name, Class<T> resultType, BiConsumer<String, StepContext> func) Executes a submitter function and waits for an external callback, blocking until the callback completes.default <T> TwaitForCallback(String name, Class<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Executes a submitter and waits for an external callback with custom configuration, blocking until complete.default <T> TwaitForCallback(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func) Executes a submitter and waits for an external callback using aTypeToken, blocking until complete.default <T> TwaitForCallback(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Executes a submitter and waits for an external callback using aTypeTokenand custom configuration.default <T> DurableFuture<T>waitForCallbackAsync(String name, Class<T> resultType, BiConsumer<String, StepContext> func) Asynchronously executes a submitter and waits for an external callback.default <T> DurableFuture<T>waitForCallbackAsync(String name, Class<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Asynchronously executes a submitter and waits for an external callback with custom configuration.default <T> DurableFuture<T>waitForCallbackAsync(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func) Asynchronously executes a submitter and waits for an external callback using aTypeToken.<T> DurableFuture<T>waitForCallbackAsync(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Asynchronously executes a submitter and waits for an external callback using aTypeTokenand custom configuration.default <T> TwaitForCondition(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Polls a condition function until it signals done, blocking until complete.default <T> TwaitForCondition(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Polls a condition function until it signals done, using a custom configuration, blocking until complete.default <T> TwaitForCondition(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Polls a condition function until it signals done, using aTypeToken, blocking until complete.default <T> TwaitForCondition(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Polls a condition function until it signals done, using aTypeTokenand custom configuration, blocking until complete.default <T> DurableFuture<T>waitForConditionAsync(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Asynchronously polls a condition function until it signals done.default <T> DurableFuture<T>waitForConditionAsync(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Asynchronously polls a condition function until it signals done, using custom configuration.default <T> DurableFuture<T>waitForConditionAsync(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Asynchronously polls a condition function until it signals done, using aTypeToken.<T> DurableFuture<T>waitForConditionAsync(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Asynchronously polls a condition function until it signals done, using aTypeTokenand custom configuration.default <T> TwithRetry(String name, BiFunction<Integer, DurableContext, T> operation) Replay-safe retry loop for any durable operation (sync) with default configuration.default <T> TwithRetry(String name, BiFunction<Integer, DurableContext, T> operation, WithRetryConfig config) Replay-safe retry loop for any durable operation (sync).default <T> DurableFuture<T>withRetryAsync(String name, BiFunction<Integer, DurableContext, T> operation) Replay-safe retry loop for any durable operation (async) with default configuration.<T> DurableFuture<T>withRetryAsync(String name, BiFunction<Integer, DurableContext, T> operation, WithRetryConfig config) Replay-safe retry loop for any durable operation (async).Methods inherited from interface software.amazon.lambda.durable.context.BaseContext
getContextId, getContextName, getDurableConfig, getExecutionArn, getLambdaContext, getLogger, getLogger
-
Method Details
-
getCurrentContext
Description copied from interface:BaseContextGets the current context (DurableContext or StepContext) for this thread.- Returns:
- the current context or null if not set
-
isReplaying
boolean isReplaying()Returns whether this context is currently replaying checkpointed durable operations. -
step
Executes a durable step with the given name and blocks until it completes.On first execution, runs
funcand checkpoints the result. On replay, returns the cached result without re-executing.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving aStepContext- Returns:
- the step result
-
step
default <T> T step(String name, Class<T> resultType, Function<StepContext, T> func, StepConfig config) Executes a durable step with the given name and configuration, blocking until it completes.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving aStepContextconfig- the step configuration (retry strategy, semantics, custom SerDes)- Returns:
- the step result
-
step
Executes a durable step using aTypeTokenfor generic result types, blocking until it completes.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic typesfunc- the function to execute, receiving aStepContext- Returns:
- the step result
-
step
default <T> T step(String name, TypeToken<T> resultType, Function<StepContext, T> func, StepConfig config) Executes a durable step using aTypeTokenand configuration, blocking until it completes.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic typesfunc- the function to execute, receiving aStepContextconfig- the step configuration (retry strategy, semantics, custom SerDes)- Returns:
- the step result
-
stepAsync
default <T> DurableFuture<T> stepAsync(String name, Class<T> resultType, Function<StepContext, T> func) Asynchronously executes a durable step, returning aDurableFuturethat can be composed or blocked on.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving aStepContext- Returns:
- a future representing the step result
-
stepAsync
default <T> DurableFuture<T> stepAsync(String name, Class<T> resultType, Function<StepContext, T> func, StepConfig config) Asynchronously executes a durable step using custom configuration.This is the core stepAsync implementation. All other step/stepAsync overloads delegate here.
- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextfunc- the function to execute, receiving aStepContextconfig- the step configuration (retry strategy, semantics, custom SerDes)- Returns:
- a future representing the step result
-
stepAsync
default <T> DurableFuture<T> stepAsync(String name, TypeToken<T> resultType, Function<StepContext, T> func) Asynchronously executes a durable step using aTypeTokenfor generic result types.This is the core stepAsync implementation. All other step/stepAsync overloads delegate here.
- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic typesfunc- the function to execute, receiving aStepContext- Returns:
- a future representing the step result
-
stepAsync
<T> DurableFuture<T> stepAsync(String name, TypeToken<T> resultType, Function<StepContext, T> func, StepConfig config) Asynchronously executes a durable step using aTypeTokenand custom configuration.This is the core stepAsync implementation. All other step/stepAsync overloads delegate here.
- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic typesfunc- the function to execute, receiving aStepContextconfig- the step configuration (retry strategy, semantics, custom SerDes)- Returns:
- a future representing the step result
-
step
Deprecated.use the variants accepting StepContext instead -
step
@Deprecated default <T> T step(String name, Class<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext instead -
step
Deprecated.use the variants accepting StepContext instead -
step
@Deprecated default <T> T step(String name, TypeToken<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext instead -
stepAsync
@Deprecated default <T> DurableFuture<T> stepAsync(String name, Class<T> resultType, Supplier<T> func) Deprecated.use the variants accepting StepContext instead -
stepAsync
@Deprecated default <T> DurableFuture<T> stepAsync(String name, Class<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext instead -
stepAsync
@Deprecated default <T> DurableFuture<T> stepAsync(String name, TypeToken<T> resultType, Supplier<T> func) Deprecated.use the variants accepting StepContext instead -
stepAsync
@Deprecated default <T> DurableFuture<T> stepAsync(String name, TypeToken<T> resultType, Supplier<T> func, StepConfig config) Deprecated.use the variants accepting StepContext instead -
wait
Suspends execution for the specified duration without consuming compute resources.On first execution, checkpoints a wait operation and suspends the Lambda. On replay after the duration has elapsed, returns immediately.
- Parameters:
name- the unique operation name within this contextduration- the duration to wait- Returns:
- always
null
-
waitAsync
Asynchronously suspends execution for the specified duration.- Parameters:
name- the unique operation name within this contextduration- the duration to wait- Returns:
- a future that completes when the wait duration has elapsed
-
invoke
Invokes another Lambda function by name and blocks until the result is available.On first execution, checkpoints a chained invoke operation that triggers the target function. On replay, returns the cached result without re-invoking.
- Type Parameters:
T- the result typeU- the payload type- Parameters:
name- the unique operation name within this contextfunctionName- the ARN or name of the Lambda function to invokepayload- the input payload to send to the target functionresultType- the result class for deserialization- Returns:
- the invocation result
-
invoke
default <T,U> T invoke(String name, String functionName, U payload, Class<T> resultType, InvokeConfig config) Invokes another Lambda function with custom configuration, blocking until the result is available. -
invoke
Invokes another Lambda function using aTypeTokenfor generic result types, blocking until complete. -
invoke
default <T,U> T invoke(String name, String functionName, U payload, TypeToken<T> resultType, InvokeConfig config) Invokes another Lambda function using aTypeTokenand custom configuration, blocking until complete. -
invokeAsync
default <T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, Class<T> resultType, InvokeConfig config) Invokes another Lambda function using aTypeTokenand custom configuration, blocking until complete. -
invokeAsync
default <T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, Class<T> resultType) Asynchronously invokes another Lambda function, returning aDurableFuture. -
invokeAsync
default <T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, TypeToken<T> resultType) Asynchronously invokes another Lambda function using aTypeTokenfor generic result types. -
invokeAsync
<T,U> DurableFuture<T> invokeAsync(String name, String functionName, U payload, TypeToken<T> resultType, InvokeConfig config) Asynchronously invokes another Lambda function using aTypeTokenand custom configuration.This is the core invokeAsync implementation. All other invoke/invokeAsync overloads delegate here.
- Type Parameters:
T- the result typeU- the payload type- Parameters:
name- the unique operation name within this contextfunctionName- the ARN or name of the Lambda function to invokepayload- the input payload to send to the target functionresultType- the type token for deserialization of generic result typesconfig- the invoke configuration (custom SerDes for result and payload)- Returns:
- a future representing the invocation result
-
createCallback
default <T> DurableCallbackFuture<T> createCallback(String name, Class<T> resultType, CallbackConfig config) Creates a callback with custom configuration. -
createCallback
Creates a callback using aTypeTokenfor generic result types. -
createCallback
Creates a callback with default configuration. -
createCallback
<T> DurableCallbackFuture<T> createCallback(String name, TypeToken<T> resultType, CallbackConfig config) Creates a callback operation that suspends execution until an external system completes it.This is the core createCallback implementation. Returns a
DurableCallbackFuturecontaining a callback ID that external systems use to report completion via the Lambda Durable API.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic result typesconfig- the callback configuration (custom SerDes)- Returns:
- a future containing the callback ID and eventual result
-
runInChildContext
Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContext- Returns:
- the child context result
-
runInChildContext
default <T> T runInChildContext(String name, TypeToken<T> resultType, Function<DurableContext, T> func) Runs a function in a child context using aTypeTokenfor generic result types, blocking until complete. -
runInChildContextAsync
default <T> DurableFuture<T> runInChildContextAsync(String name, Class<T> resultType, Function<DurableContext, T> func) Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Parameters:
name- the operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContext- Returns:
- the DurableFuture of the child context result
-
runInChildContextAsync
default <T> DurableFuture<T> runInChildContextAsync(String name, TypeToken<T> resultType, Function<DurableContext, T> func) Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Parameters:
name- the operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContext- Returns:
- the DurableFuture of the child context result
-
runInChildContext
default <T> T runInChildContext(String name, Class<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContext- Returns:
- the child context result
-
runInChildContext
default <T> T runInChildContext(String name, TypeToken<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Parameters:
name- the operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContextconfig- the configuration for the child context- Returns:
- the child context result
-
runInChildContextAsync
default <T> DurableFuture<T> runInChildContextAsync(String name, Class<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Parameters:
name- the operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContextconfig- the configuration for the child context- Returns:
- the DurableFuture wrapping the child context result
-
runInChildContextAsync
<T> DurableFuture<T> runInChildContextAsync(String name, TypeToken<T> resultType, Function<DurableContext, T> func, RunInChildContextConfig config) Runs a function in a child context, blocking until it completes.Child contexts provide isolated operation ID namespaces, allowing nested workflows to be composed without ID collisions. On replay, the child context's operations are replayed independently.
- Parameters:
name- the operation name within this contextresultType- the result class for deserializationfunc- the function to execute, receiving a childDurableContextconfig- the configuration for the child context- Returns:
- the DurableFuture wrapping the child context result
-
map
default <I,O> MapResult<O> map(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function) -
map
default <I,O> MapResult<O> map(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) -
map
default <I,O> MapResult<O> map(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function) -
map
default <I,O> MapResult<O> map(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) -
mapAsync
default <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function) -
mapAsync
default <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, Class<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) -
mapAsync
default <I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function) -
mapAsync
<I,O> DurableFuture<MapResult<O>> mapAsync(String name, Collection<I> items, TypeToken<O> resultType, DurableContext.MapFunction<I, O> function, MapConfig config) -
parallel
Creates aParallelDurableFuturefor executing multiple branches concurrently with default config- Returns:
- a new ParallelDurableFuture for registering and executing branches
-
parallel
Creates aParallelDurableFuturefor executing multiple branches concurrently.- Parameters:
config- the parallel execution configuration- Returns:
- a new ParallelDurableFuture for registering and executing branches
-
waitForCallback
default <T> T waitForCallback(String name, Class<T> resultType, BiConsumer<String, StepContext> func) Executes a submitter function and waits for an external callback, blocking until the callback completes.Combines a step (to run the submitter) and a callback (to receive the external result) in a child context. The submitter receives a callback ID that external systems use to report completion.
If a failed child is replayed without its nested operation details and its original exception cannot be reconstructed,
ChildContextFailedExceptioncarries the stored context failure. The SDK does not guess whether the missing callback or submitter caused it, and does not rerun the completed child.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationfunc- the submitter function, receiving the callback ID and aStepContext- Returns:
- the callback result
-
waitForCallback
default <T> T waitForCallback(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func) Executes a submitter and waits for an external callback using aTypeToken, blocking until complete. -
waitForCallback
default <T> T waitForCallback(String name, Class<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Executes a submitter and waits for an external callback with custom configuration, blocking until complete. -
waitForCallback
default <T> T waitForCallback(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Executes a submitter and waits for an external callback using aTypeTokenand custom configuration. -
waitForCallbackAsync
default <T> DurableFuture<T> waitForCallbackAsync(String name, Class<T> resultType, BiConsumer<String, StepContext> func) Asynchronously executes a submitter and waits for an external callback. -
waitForCallbackAsync
default <T> DurableFuture<T> waitForCallbackAsync(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func) Asynchronously executes a submitter and waits for an external callback using aTypeToken. -
waitForCallbackAsync
default <T> DurableFuture<T> waitForCallbackAsync(String name, Class<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Asynchronously executes a submitter and waits for an external callback with custom configuration. -
waitForCallbackAsync
<T> DurableFuture<T> waitForCallbackAsync(String name, TypeToken<T> resultType, BiConsumer<String, StepContext> func, WaitForCallbackConfig waitForCallbackConfig) Asynchronously executes a submitter and waits for an external callback using aTypeTokenand custom configuration.This is the core waitForCallbackAsync implementation. All other waitForCallback/waitForCallbackAsync overloads delegate here. Internally creates a child context containing a callback operation and a step that runs the submitter function.
Retrieving a failed replay's result can report
ChildContextFailedExceptionwhen nested operation details are no longer available and the original exception cannot be reconstructed.- Type Parameters:
T- the result type- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic result typesfunc- the submitter function, receiving the callback ID and aStepContextwaitForCallbackConfig- the configuration for both the callback and submitter step- Returns:
- a future representing the callback result
-
waitForCondition
default <T> T waitForCondition(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Polls a condition function until it signals done, blocking until complete.- Type Parameters:
T- the type of state being polled- Parameters:
name- the unique operation name within this contextresultType- the result class for deserializationcheckFunc- the function that evaluates the condition and returns aWaitForConditionResult- Returns:
- the final state value when the condition is met
-
waitForCondition
default <T> T waitForCondition(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Polls a condition function until it signals done, using a custom configuration, blocking until complete. -
waitForCondition
default <T> T waitForCondition(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Polls a condition function until it signals done, using aTypeToken, blocking until complete. -
waitForCondition
default <T> T waitForCondition(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Polls a condition function until it signals done, using aTypeTokenand custom configuration, blocking until complete. -
waitForConditionAsync
default <T> DurableFuture<T> waitForConditionAsync(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Asynchronously polls a condition function until it signals done. -
waitForConditionAsync
default <T> DurableFuture<T> waitForConditionAsync(String name, Class<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Asynchronously polls a condition function until it signals done, using custom configuration. -
waitForConditionAsync
default <T> DurableFuture<T> waitForConditionAsync(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc) Asynchronously polls a condition function until it signals done, using aTypeToken. -
waitForConditionAsync
<T> DurableFuture<T> waitForConditionAsync(String name, TypeToken<T> resultType, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, WaitForConditionConfig<T> config) Asynchronously polls a condition function until it signals done, using aTypeTokenand custom configuration.This is the core waitForConditionAsync implementation. All other waitForCondition/waitForConditionAsync overloads delegate here.
- Type Parameters:
T- the type of state being polled- Parameters:
name- the unique operation name within this contextresultType- the type token for deserialization of generic typescheckFunc- the function that evaluates the condition and returns aWaitForConditionResultconfig- the waitForCondition configuration (wait strategy, custom SerDes)- Returns:
- a future representing the final state value
-
withRetry
Replay-safe retry loop for any durable operation (sync) with default configuration.Uses
WithRetryConfigdefaults:RetryStrategies.Presets.DEFAULTretry strategy and no child context wrapping.- Type Parameters:
T- the result type- Parameters:
name- operation name (used for backoff wait names, and as the child context name when wrapping); passnullfor an anonymous retry whose backoff waits use default namesoperation- the retryable operation — receives the 1-based attempt number and the durable context- Returns:
- the operation result
- See Also:
-
withRetry
default <T> T withRetry(String name, BiFunction<Integer, DurableContext, T> operation, WithRetryConfig config) Replay-safe retry loop for any durable operation (sync).Provides the same retry-with-backoff pattern that
step()has built in, but for operations that cannot live inside a step (waitForCallback,invoke,waitForCondition, etc.).Every side-effect in the loop is a durable operation, so the loop is replay-safe by construction. On replay, completed operations return cached results instantly and the loop fast-forwards to the current attempt.
The retry loop always runs in a child context to provide an isolated operation ID namespace. If
WithRetryConfig.wrapInChildContext()is enabled, the child context is checkpointed (persisted) so all attempts are grouped under a single named operation in execution history. Otherwise, a virtual child context is used — no checkpointing overhead, but the child re-executes on replay.- Type Parameters:
T- the result type- Parameters:
name- operation name (used for backoff wait names, and as the child context name when wrapping); passnullfor an anonymous retry whose backoff waits use default namesoperation- the retryable operation — receives the 1-based attempt number and the durable contextconfig- retry configuration including the retry strategy and child context wrapping- Returns:
- the operation result
-
withRetryAsync
default <T> DurableFuture<T> withRetryAsync(String name, BiFunction<Integer, DurableContext, T> operation) Replay-safe retry loop for any durable operation (async) with default configuration.Uses
WithRetryConfigdefaults:RetryStrategies.Presets.DEFAULTretry strategy and no child context wrapping.- Type Parameters:
T- the result type- Parameters:
name- operation name (used for child context and backoff wait names); passnullfor an anonymous retry whose backoff waits use default namesoperation- the retryable operation — receives the 1-based attempt number and the durable context- Returns:
- a future representing the operation result
- See Also:
-
withRetryAsync
<T> DurableFuture<T> withRetryAsync(String name, BiFunction<Integer, DurableContext, T> operation, WithRetryConfig config) Replay-safe retry loop for any durable operation (async).The retry loop always runs in a child context to provide an isolated operation ID namespace. If
WithRetryConfig.wrapInChildContext()is enabled, the child context is checkpointed (persisted) so all attempts are grouped under a single named operation in execution history. Otherwise, a virtual child context is used — no checkpointing overhead, but the child re-executes on replay.- Type Parameters:
T- the result type- Parameters:
name- operation name (used for child context and backoff wait names); passnullfor an anonymous retry whose backoff waits use default namesoperation- the retryable operation — receives the 1-based attempt number and the durable contextconfig- retry configuration including the retry strategy- Returns:
- a future representing the operation result
-