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 thePersistentTaskis known or not.Set<TaskId<? extends Serializable>> <T extends Serializable>
Optional<PersistentTask<T>> <T extends Serializable>
StateSerializer<T> getStateSerializer(TaskId<T> taskId, StateSerializer<?> fallBack) <T extends Serializable>
Optional<org.springframework.transaction.support.TransactionTemplate> Returns aTransactionTemplateif the task and the framework may join transaction.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>
voidregisterStateSerializer(TaskId<T> id, StateSerializer<T> serializer) <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.<T extends Serializable>
TaskId<T> replace(TaskId<T> id, 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
-
registerStateSerializer
public <T extends Serializable> void registerStateSerializer(@NonNull TaskId<T> id, @NonNull StateSerializer<T> serializer) -
getStateSerializer
public <T extends Serializable> StateSerializer<T> getStateSerializer(TaskId<T> taskId, StateSerializer<?> fallBack) -
get
-
getTransactionTemplateIfJoinable
public <T extends Serializable> Optional<org.springframework.transaction.support.TransactionTemplate> getTransactionTemplateIfJoinable(PersistentTask<T> task) Returns aTransactionTemplateif the task and the framework may join transaction. -
assertIsKnown
Check if thePersistentTaskis known or not.- Type Parameters:
T- the state type- Parameters:
id- theTaskIdof thePersistentTask- Returns:
- the
PersistentTaskregistered 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. -
replace
A way to manually register a PersistentTask, usually not needed as spring beans will be added automatically.
-