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 TypeMethodDescriptionvoidCalled during the task execution with the stored state.default voidafterTriggerFailed(T state, Exception e) Callback handler which is invoked once after: if the trigger is finally failed or the trigger is abandoned
This method is not invoked for expired triggers waiting for an signal.default booleanWhether the persistentTask is transaction or not.default RetryStrategy
-
Method Details
-
accept
Called during the task execution with the stored state.-
RunningTriggerContextHoldercan be used to access the full state. -
Fire
TriggerTaskCommandevents to schedule new tasks. -
Consider to use a
TransactionalTaskin 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. Iftruethe 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:
trueif the persistentTask is transactional;falseotherwise.
-
afterTriggerFailed
Callback handler which is invoked once after:- if the trigger is finally failed
- or the trigger is abandoned
This method is not invoked for expired triggers waiting for an signal.- Parameters:
state- the state, could benullif the state could be parsede- the exception reason - could also be aFailTaskNoRetryException- See Also:
-