Package akka.javasdk.workflow
Class Workflow.WorkflowSettingsBuilder
Object
akka.javasdk.workflow.Workflow.WorkflowSettingsBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionWorkflowSettingsBuilder(Optional<Duration> defaultStepTimeout, Optional<Workflow.RecoverStrategy<?>> defaultStepRecoverStrategy, Map<String, Workflow.StepSettings> stepSettingsMap, Optional<Duration> passivationDelay, Optional<Duration> workflowTimeout, Optional<Workflow.RecoverStrategy<?>> workflowRecoveryStrategy) -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates the final workflow configuration from this builder.defaultStepRecovery(Workflow.RecoverStrategy<?> recoverStrategy) Deprecated.defaultStepTimeout(Duration timeout) Define a default timeout duration for all steps.passivationDelay(Duration delay) A paused (or finished) workflow will be kept in memory for the given delay before being passivated.stepRecovery(akka.japi.function.Function<W, Workflow.StepEffect> lambda, Workflow.RecoverStrategy<?> recovery) Configure a specific step with a recovery strategy.stepRecovery(akka.japi.function.Function2<W, I, Workflow.StepEffect> lambda, Workflow.RecoverStrategy<?> recovery) Configure a specific step with a recovery strategy.stepTimeout(akka.japi.function.Function<W, Workflow.StepEffect> lambda, Duration timeout) Configure a specific step with a timeout.stepTimeout(akka.japi.function.Function2<W, I, Workflow.StepEffect> lambda, Duration timeout) Configure a specific step with a timeout.Define a timeout for the duration of the entire workflow.timeout(Duration timeout, akka.japi.function.Function<W, Workflow.StepEffect> timeoutFailoverStep) Define a timeout for the duration of the entire workflow with a timeout handler step.timeout(Duration timeout, akka.japi.function.Function2<W, I, Workflow.StepEffect> timeoutFailoverStep, I input) Define a timeout for the duration of the entire workflow with a timeout handler step that accepts input.
-
Constructor Details
-
WorkflowSettingsBuilder
public WorkflowSettingsBuilder(Optional<Duration> defaultStepTimeout, Optional<Workflow.RecoverStrategy<?>> defaultStepRecoverStrategy, Map<String, Workflow.StepSettings> stepSettingsMap, Optional<Duration> passivationDelay, Optional<Duration> workflowTimeout, Optional<Workflow.RecoverStrategy<?>> workflowRecoveryStrategy)
-
-
Method Details
-
newBuilder
-
timeout
Define a timeout for the duration of the entire workflow. When the timeout expires, the workflow is finished and no transitions are allowed.- Parameters:
timeout- Timeout duration
-
timeout
public <W> Workflow.WorkflowSettingsBuilder timeout(Duration timeout, akka.japi.function.Function<W, Workflow.StepEffect> timeoutFailoverStep) Define a timeout for the duration of the entire workflow with a timeout handler step. When the timeout expires, the specified timeout handler step will be executed to handle the timeout gracefully (e.g., cleanup, logging, or compensation). The timeout handler step must end the workflow - no further step transitions are allowed after a global timeout.- Parameters:
timeout- Timeout durationtimeoutFailoverStep- Reference to the timeout handler step method
-
timeout
public <W,I> Workflow.WorkflowSettingsBuilder timeout(Duration timeout, akka.japi.function.Function2<W, I, Workflow.StepEffect> timeoutFailoverStep, I input) Define a timeout for the duration of the entire workflow with a timeout handler step that accepts input. When the timeout expires, the specified timeout handler step will be executed with the provided input to handle the timeout gracefully (e.g., cleanup, logging, or compensation). The timeout handler step must end the workflow - no further step transitions are allowed after a global timeout.- Parameters:
timeout- Timeout durationtimeoutFailoverStep- Reference to the timeout handler step methodinput- Input parameter to pass to the timeout handler step
-
defaultStepTimeout
Define a default timeout duration for all steps. Can be overridden per step. -
defaultStepRecovery
@Deprecated public Workflow.WorkflowSettingsBuilder defaultStepRecovery(Workflow.RecoverStrategy<?> recoverStrategy) Deprecated.Define a default recovery strategy for all steps. Can be overridden per step. -
stepTimeout
public <W> Workflow.WorkflowSettingsBuilder stepTimeout(akka.japi.function.Function<W, Workflow.StepEffect> lambda, Duration timeout) Configure a specific step with a timeout.- Parameters:
lambda- Reference to the step methodtimeout- Timeout duration for this step
-
stepTimeout
public <W,I> Workflow.WorkflowSettingsBuilder stepTimeout(akka.japi.function.Function2<W, I, Workflow.StepEffect> lambda, Duration timeout) Configure a specific step with a timeout.- Parameters:
lambda- Reference to the step methodtimeout- Timeout duration for this step
-
stepRecovery
public <W> Workflow.WorkflowSettingsBuilder stepRecovery(akka.japi.function.Function<W, Workflow.StepEffect> lambda, Workflow.RecoverStrategy<?> recovery) Configure a specific step with a recovery strategy.- Parameters:
lambda- Reference to the step methodrecovery- Recovery strategy for this step
-
stepRecovery
public <W,I> Workflow.WorkflowSettingsBuilder stepRecovery(akka.japi.function.Function2<W, I, Workflow.StepEffect> lambda, Workflow.RecoverStrategy<?> recovery) Configure a specific step with a recovery strategy.- Parameters:
lambda- Reference to the step methodrecovery- Recovery strategy for this step
-
passivationDelay
A paused (or finished) workflow will be kept in memory for the given delay before being passivated. This improves the performance of resuming such a workflow because it doesn't have to be recovered from the storage. -
build
Creates the final workflow configuration from this builder.- Returns:
- The complete workflow configuration
-