Class WorkflowSettings
- java.lang.Object
-
- io.nflow.engine.model.ModelObject
-
- io.nflow.engine.workflow.definition.WorkflowSettings
-
public class WorkflowSettings extends ModelObject
Configuration for the workflow execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkflowSettings.BuilderBuilder for workflow settings.
-
Field Summary
Fields Modifier and Type Field Description shortdefaultPriorityDefault priority for new workflow instances.BooleanSupplierdeleteHistoryConditionCondition to check if workflow instance history should be deleted (unless forced via StateExecution).org.joda.time.ReadablePeriodhistoryDeletableAfterDelay after which workflow instance history (actions, states) can be deleted from database by nFlow.longmaxErrorTransitionDelayMaximum delay on execution retry after an error.intmaxRetriesMaximum retry attempts.intmaxSubsequentStateExecutionsMaximum number of subsequent state executions before forcing a short transition delay.Map<WorkflowState,Integer>maxSubsequentStateExecutionsPerStateMaximum number of subsequent state executions before forcing a short transition delay, per state.longminErrorTransitionDelayMinimum delay on execution retry after an error.longshortTransitionDelayLength of forced delay to break execution of a step that is considered to be busy looping.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateProcessExceptionHandlinganalyzeExeption(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.booleandeleteWorkflowInstanceHistory()Return true if workflow instance history should be deleted.ShortgetDefaultPriority()Return default priority for new workflow instances.org.joda.time.DateTimegetErrorTransitionActivation(int retryCount)Return next activation time after error.intgetMaxSubsequentStateExecutions(WorkflowState state)Return the maximum number of subsequent state executions before forcing a short transition delay.org.joda.time.DateTimegetShortTransitionActivation()Return the delay before next activation after detecting a busy loop.-
Methods inherited from class io.nflow.engine.model.ModelObject
equals, hashCode, toString
-
-
-
-
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.
-
-