Class TasksHandler.Builder
java.lang.Object
org.springframework.statemachine.recipes.tasks.TasksHandler.Builder
- Enclosing class:
- TasksHandler
Builder pattern implementation building a
TasksHandler
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theTasksHandler
.listener
(TasksHandler.TasksListener listener) Define aTasksHandler.TasksListener
to be registered.persist
(StateMachinePersist<String, String, Void> persist) Define aStateMachinePersist
implementation 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 aTaskExecutor
to 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 aStateMachinePersist
implementation if state machine should be persisted with state changes.- Parameters:
persist
- the persist- Returns:
- the builder for chaining
-
listener
Define aTasksHandler.TasksListener
to be registered.- Parameters:
listener
- the tasks listener- Returns:
- the builder for chaining
-
taskExecutor
Define aTaskExecutor
to be used. Default executor will be aThreadPoolTaskExecutor
set 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
-