Class WorkflowSettings.Builder
java.lang.Object
io.nflow.engine.workflow.definition.WorkflowSettings.Builder
- Enclosing class:
WorkflowSettings
Builder for workflow settings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create workflow settings object.static BooleanSupplier
onAverageEveryNthExecution
(int n) Returns true randomly every n:th time.static BooleanSupplier
Returns true once per day (during early hours).setDefaultPriority
(short defaultPriority) Set the default priority for new workflow instances.setDeleteHistoryCondition
(BooleanSupplier deleteHistoryCondition) Set the condition to be checked to decide if workflow instance history should be deleted.setExceptionAnalyzer
(BiFunction<WorkflowState, Throwable, StateProcessExceptionHandling> exceptionAnalyzer) Set the exception analyzer function.setHistoryDeletableAfter
(org.joda.time.ReadablePeriod period) Set the delay after which workflow history (actions, states) can be deleted from the database by nFlow.setMaxErrorTransitionDelay
(org.joda.time.Duration maxErrorTransitionDelay) Set the maximum delay on execution retry after an error.setMaxRetries
(int maxRetries) Set maximum retry attempts.setMaxSubsequentStateExecutions
(int maxSubsequentStateExecutions) Set maximum number of subsequent state executions before forcing a short transition delay.setMaxSubsequentStateExecutions
(WorkflowState state, int maxSubsequentStateExecutions) Set maximum number of subsequent state executions before forcing a short transition delay for given state.setMinErrorTransitionDelay
(org.joda.time.Duration minErrorTransitionDelay) Set the minimum delay on execution retry after an error.setShortTransitionDelay
(org.joda.time.Duration shortTransitionDelay) Set the length of forced delay to break execution of a step that is considered to be busy looping.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
onAverageEveryNthExecution
Returns true randomly every n:th time.- Parameters:
n
- Controls the frequency of returning true. With n=1, returns true every time. With n=100, returns true on average once per 100 calls.- Returns:
- Producer of boolean values
-
oncePerDay
Returns true once per day (during early hours).- Returns:
- Producer of boolean values
-
setMaxErrorTransitionDelay
public WorkflowSettings.Builder setMaxErrorTransitionDelay(org.joda.time.Duration maxErrorTransitionDelay) Set the maximum delay on execution retry after an error.- Parameters:
maxErrorTransitionDelay
- The delay.- Returns:
- this.
-
setMinErrorTransitionDelay
public WorkflowSettings.Builder setMinErrorTransitionDelay(org.joda.time.Duration minErrorTransitionDelay) Set the minimum delay on execution retry after an error.- Parameters:
minErrorTransitionDelay
- The delay.- Returns:
- this.
-
setShortTransitionDelay
public WorkflowSettings.Builder setShortTransitionDelay(org.joda.time.Duration shortTransitionDelay) Set the length of forced delay to break execution of a step that is considered to be busy looping.- Parameters:
shortTransitionDelay
- The delay.- Returns:
- this.
-
setMaxRetries
Set maximum retry attempts.- Parameters:
maxRetries
- Maximum number of retries.- Returns:
- this.
-
setMaxSubsequentStateExecutions
Set maximum number of subsequent state executions before forcing a short transition delay.- Parameters:
maxSubsequentStateExecutions
- Maximum number of subsequent state executions.- Returns:
- this.
-
setMaxSubsequentStateExecutions
public WorkflowSettings.Builder setMaxSubsequentStateExecutions(WorkflowState state, int maxSubsequentStateExecutions) Set maximum number of subsequent state executions before forcing a short transition delay for given state.- Parameters:
state
- The state for which the limit is applied.maxSubsequentStateExecutions
- Maximum number of subsequent state executions.- Returns:
- this.
-
setHistoryDeletableAfter
Set the delay after which workflow history (actions, states) can be deleted from the database by nFlow. Setting value tonull
indicates that history is not deletable. Default is 45 days.- Parameters:
period
- Delay after which history can be deleted.- Returns:
- this.
-
setDeleteHistoryCondition
Set the condition to be checked to decide if workflow instance history should be deleted.- Parameters:
deleteHistoryCondition
- Function to be called.- Returns:
- this.
-
setDefaultPriority
Set the default priority for new workflow instances.- Parameters:
defaultPriority
- Default priority.- Returns:
- this.
-
setExceptionAnalyzer
public WorkflowSettings.Builder setExceptionAnalyzer(BiFunction<WorkflowState, Throwable, StateProcessExceptionHandling> exceptionAnalyzer) Set the exception analyzer function.- Parameters:
exceptionAnalyzer
- The exception analyzer function.- Returns:
- this.
-
build
Create workflow settings object.- Returns:
- Workflow settings.
-