Interface PersistentTask<T extends Serializable>

Type Parameters:
T - the type of the state, which must be Serializable
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.

@FunctionalInterface public interface PersistentTask<T extends Serializable>
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 Type
    Method
    Description
    void
    accept(T state)
    Called during the task execution with the stored state.
    default boolean
    Whether the persistentTask is transaction or not.
     
  • Method Details

    • accept

      void accept(@Nullable T state)
      Called during the task execution with the stored state.
      Parameters:
      state - the state of this trigger, can be null
    • retryStrategy

      default RetryStrategy retryStrategy()
    • isTransactional

      default boolean isTransactional()
      Whether the persistentTask is transaction or not. If true the execution is wrapped into the default transaction template together with the state update and the following events:
      1. org.sterl.spring.persistent_tasks.trigger.event.TriggerRunningEvent
      2. org.sterl.spring.persistent_tasks.trigger.event.TriggerSuccessEvent
      Returns:
      true if the persistentTask is transactional; false otherwise.