Class WorkflowSettings


  • public class WorkflowSettings
    extends ModelObject
    Configuration for the workflow execution.
    • Field Detail

      • minErrorTransitionDelay

        public final long minErrorTransitionDelay
        Minimum delay on execution retry after an error. Unit is milliseconds.
      • maxErrorTransitionDelay

        public final long maxErrorTransitionDelay
        Maximum delay on execution retry after an error. Unit is milliseconds.
      • shortTransitionDelay

        public final long shortTransitionDelay
        Length of forced delay to break execution of a step that is considered to be busy looping. Unit is milliseconds.
      • maxRetries

        public final int maxRetries
        Maximum retry attempts.
      • maxSubsequentStateExecutions

        public final int maxSubsequentStateExecutions
        Maximum number of subsequent state executions before forcing a short transition delay.
      • maxSubsequentStateExecutionsPerState

        public final Map<WorkflowState,​Integer> maxSubsequentStateExecutionsPerState
        Maximum number of subsequent state executions before forcing a short transition delay, per state.
      • historyDeletableAfter

        public final org.joda.time.ReadablePeriod historyDeletableAfter
        Delay after which workflow instance history (actions, states) can be deleted from database by nFlow.
      • deleteHistoryCondition

        public final BooleanSupplier deleteHistoryCondition
        Condition to check if workflow instance history should be deleted (unless forced via StateExecution). Ignored if historyDeletableAfterHours is not set. By default, returns true roughly every tenth time.
      • defaultPriority

        public final short defaultPriority
        Default priority for new workflow instances.
    • Method Detail

      • getErrorTransitionActivation

        public org.joda.time.DateTime getErrorTransitionActivation​(int retryCount)
        Return next activation time after error.
        Parameters:
        retryCount - Number of retry attemps.
        Returns:
        Next activation time.
      • calculateBinaryBackoffDelay

        protected long calculateBinaryBackoffDelay​(int retryCount,
                                                   long minDelay,
                                                   long maxDelay)
        Return activation delay based on retry attempt number.
        Parameters:
        retryCount - Retry attempt number.
        minDelay - Minimum retry delay.
        maxDelay - Maximum retry delay.
        Returns:
        Delay in milliseconds.
      • getShortTransitionActivation

        public org.joda.time.DateTime getShortTransitionActivation()
        Return the delay before next activation after detecting a busy loop.
        Returns:
        The delay in milliseconds.
      • getMaxSubsequentStateExecutions

        public int getMaxSubsequentStateExecutions​(WorkflowState state)
        Return the maximum number of subsequent state executions before forcing a short transition delay.
        Parameters:
        state - The state for which the limit is checked.
        Returns:
        The maximum number of subsequent state executions.
      • deleteWorkflowInstanceHistory

        public boolean deleteWorkflowInstanceHistory()
        Return true if workflow instance history should be deleted. Called by WorkflowStateProcessor after processing a state if historyDeletableAfterHours is set. With default settings, returns true roughly every hundredth time. To override, set deleteHistoryCondition.
        Returns:
        True if workflow instance history should be deleted.
      • getDefaultPriority

        public Short getDefaultPriority()
        Return default priority for new workflow instances.
        Returns:
        Default priority for new workflow instances.
      • analyzeExeption

        public StateProcessExceptionHandling analyzeExeption​(WorkflowState state,
                                                             Throwable thrown)
        Analyze exception thrown by a state method to determine how it should be handled.
        Parameters:
        state - The state that failed to be processed.
        thrown - The exception to be analyzed.
        Returns:
        How the exception should be handled.