Interface WorkflowExecutorListener

All Known Implementing Classes:
WorkflowLogContextListener

public interface WorkflowExecutorListener
WorkflowExecutorListener is a global, stateless listener for workflow executors. The interface contains default (no-op) method implementations.

Same instance of WorkflowExecutorListener is used for all workflow state executions: all state must be stored in ListenerContext.data.

  • Method Details

    • beforeProcessing

      default void beforeProcessing(WorkflowExecutorListener.ListenerContext listenerContext)
      Executed before state is processed. Exceptions are logged but they do not affect workflow processing.
      Parameters:
      listenerContext - The listener context.
    • process

      default NextAction process(WorkflowExecutorListener.ListenerContext listenerContext, ListenerChain chain)
      Processing chain. Process methods in listeners form a Chain of Responsibility pattern. Listener can either call chain.next(listenerContext) to proceed to next filter or not to call it causing processing of state to be skipped. Changes to workflowInstance (not child workflows or state variables) by the filter will be persisted to database.

      Typical implementation:

      public NextAction process(ListenerContext listenerContext, ListenerChain chain) { return chain.next(listenerContext); }
      Parameters:
      listenerContext - The listener context.
      chain - The listener chain.
      Returns:
      NextAction
    • afterProcessing

      default void afterProcessing(WorkflowExecutorListener.ListenerContext listenerContext)
      Executed after state has been successfully processed and before persisting state. Exceptions are logged but they do not affect workflow processing.
      Parameters:
      listenerContext - The listener context.
    • afterFailure

      default void afterFailure(WorkflowExecutorListener.ListenerContext listenerContext, Throwable throwable)
      Executed after state processing has failed and before persisting state. Exceptions are logged but they do not affect workflow processing.
      Parameters:
      listenerContext - The listener context.
      throwable - The exception thrown by the state handler method.
    • handlePotentiallyStuck

      default boolean handlePotentiallyStuck(WorkflowExecutorListener.ListenerContext listenerContext, org.joda.time.Duration processingTime)
      Called when instance processing is potentially stuck. Return true to interrupt the processing thread. Default implementation returns false.
      Parameters:
      listenerContext - The listener context.
      processingTime - How long the instances has been processed.
      Returns:
      True if processing should be interruped, false otherwise.