Interface PersistentTask<T extends Serializable>
- Type Parameters:
T
- the type of the state, which must beSerializable
- All Known Subinterfaces:
TransactionalTask<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A Spring persistent task whose state is saved in a
Trigger
.
This interface defines a task that accepts a state of type T
and
provides default implementations for retry strategies.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called during the task execution with the stored state.default boolean
Whether the persistentTask is transaction or not.default RetryStrategy
-
Method Details
-
accept
Called during the task execution with the stored state.-
RunningTriggerContextHolder
can be used to access the full state. -
Fire
TriggerTaskCommand
events to schedule new tasks. -
Consider to use a
TransactionalTask
in case the triggers or the state should be written together in one transaction.
- Parameters:
state
- the state of this trigger, can benull
-
-
retryStrategy
-
isTransactional
default boolean isTransactional()Whether the persistentTask is transaction or not. Iftrue
the execution is wrapped into the default transaction template together with the state update and the following events:- org.sterl.spring.persistent_tasks.trigger.event.TriggerRunningEvent
- org.sterl.spring.persistent_tasks.trigger.event.TriggerSuccessEvent
- Returns:
true
if the persistentTask is transactional;false
otherwise.
-