Class TasksHandler.Builder
java.lang.Object
org.springframework.statemachine.recipes.tasks.TasksHandler.Builder
- Enclosing class:
- TasksHandler
Builder pattern implementation building a
TasksHandler.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theTasksHandler.listener(TasksHandler.TasksListener listener) Define aTasksHandler.TasksListenerto be registered.persist(StateMachinePersist<String, String, Void> persist) Define aStateMachinePersistimplementation if state machine should be persisted with state changes.Define a sub-task with a reference to its parent.Define a top-level task.taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Define aTaskExecutorto be used.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
task
Define a top-level task.- Parameters:
id- the idrunnable- the runnable- Returns:
- the builder for chaining
-
task
Define a sub-task with a reference to its parent.- Parameters:
parent- the parentid- the idrunnable- the runnable- Returns:
- the builder for chaining
-
persist
Define aStateMachinePersistimplementation if state machine should be persisted with state changes.- Parameters:
persist- the persist- Returns:
- the builder for chaining
-
listener
Define aTasksHandler.TasksListenerto be registered.- Parameters:
listener- the tasks listener- Returns:
- the builder for chaining
-
taskExecutor
Define aTaskExecutorto be used. Default executor will be aThreadPoolTaskExecutorset with a thread pool size of a top-level task count.- Parameters:
taskExecutor- the task executor- Returns:
- the builder for chaining
-
build
Builds theTasksHandler.- Returns:
- the tasks handler
-