Class TaskService
java.lang.Object
org.sterl.spring.persistent_tasks.task.TaskService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Serializable>
PersistentTask<T> assertIsKnown
(TaskId<T> id) Check if thePersistentTask
is known or not.Set
<TaskId<? extends Serializable>> <T extends Serializable>
Optional<PersistentTask<T>> <T extends Serializable>
Optional<org.springframework.transaction.support.TransactionTemplate> getTransactionTemplate
(PersistentTask<T> task) register
(String name, Consumer<Serializable> task) A way to manually register a PersistentTask, usually better to usePersistentTask
.<T extends Serializable>
TaskId<T> register
(String name, PersistentTask<T> task) A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically.<T extends Serializable>
TaskId<T> register
(TaskId<T> id, PersistentTask<T> task) A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically.<T extends Serializable>
TaskId<T> replace
(String name, PersistentTask<T> task) A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically.
-
Constructor Details
-
TaskService
public TaskService()
-
-
Method Details
-
findAllTaskIds
-
get
-
getTransactionTemplate
public <T extends Serializable> Optional<org.springframework.transaction.support.TransactionTemplate> getTransactionTemplate(PersistentTask<T> task) -
assertIsKnown
Check if thePersistentTask
is known or not.- Type Parameters:
T
- the state type- Parameters:
id
- theTaskId
of thePersistentTask
- Returns:
- the
PersistentTask
registered to the given id - Throws:
IllegalStateException
- if the id is unknown
-
register
A way to manually register a PersistentTask, usually better to usePersistentTask
. -
register
A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically. -
register
A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically. -
replace
A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically.
-