Class WorkflowSettings
java.lang.Object
io.nflow.engine.model.ModelObject
io.nflow.engine.workflow.definition.WorkflowSettings
Configuration for the workflow execution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for workflow settings. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal shortDefault priority for new workflow instances.final BooleanSupplierCondition to check if workflow instance history should be deleted (unless forced via StateExecution).final org.joda.time.ReadablePeriodDelay after which workflow instance history (actions, states) can be deleted from database by nFlow.final longMaximum delay on execution retry after an error.final intMaximum retry attempts.final intMaximum number of subsequent state executions before forcing a short transition delay.final Map<WorkflowState,Integer> Maximum number of subsequent state executions before forcing a short transition delay, per state.final longMinimum delay on execution retry after an error.final longLength of forced delay to break execution of a step that is considered to be busy looping. -
Method Summary
Modifier and TypeMethodDescriptionanalyzeExeption(WorkflowState state, Throwable thrown) Analyze exception thrown by a state method to determine how it should be handled.protected longcalculateBinaryBackoffDelay(int retryCount, long minDelay, long maxDelay) Return activation delay based on retry attempt number.booleanReturn true if workflow instance history should be deleted.Return default priority for new workflow instances.org.joda.time.DateTimegetErrorTransitionActivation(int retryCount) Return next activation time after error.intReturn the maximum number of subsequent state executions before forcing a short transition delay.org.joda.time.DateTimeReturn the delay before next activation after detecting a busy loop.Methods inherited from class io.nflow.engine.model.ModelObject
equals, hashCode, toString
-
Field Details
-
minErrorTransitionDelay
public final long minErrorTransitionDelayMinimum delay on execution retry after an error. Unit is milliseconds. -
maxErrorTransitionDelay
public final long maxErrorTransitionDelayMaximum delay on execution retry after an error. Unit is milliseconds. -
shortTransitionDelay
public final long shortTransitionDelayLength of forced delay to break execution of a step that is considered to be busy looping. Unit is milliseconds. -
maxRetries
public final int maxRetriesMaximum retry attempts. -
maxSubsequentStateExecutions
public final int maxSubsequentStateExecutionsMaximum number of subsequent state executions before forcing a short transition delay. -
maxSubsequentStateExecutionsPerState
Maximum number of subsequent state executions before forcing a short transition delay, per state. -
historyDeletableAfter
public final org.joda.time.ReadablePeriod historyDeletableAfterDelay after which workflow instance history (actions, states) can be deleted from database by nFlow. -
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 defaultPriorityDefault priority for new workflow instances.
-
-
Method Details
-
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
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
Return default priority for new workflow instances.- Returns:
- Default priority for new workflow instances.
-
analyzeExeption
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.
-