Class WorkflowSettings.Builder
- java.lang.Object
-
- io.nflow.engine.workflow.definition.WorkflowSettings.Builder
-
- Enclosing class:
- WorkflowSettings
public static class WorkflowSettings.Builder extends Object
Builder for workflow settings.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkflowSettingsbuild()Create workflow settings object.static BooleanSupplieronAverageEveryNthExecution(int n)Returns true randomly every n:th time.static BooleanSupplieroncePerDay()Returns true once per day (during early hours).WorkflowSettings.BuildersetDefaultPriority(short defaultPriority)Set the default priority for new workflow instances.WorkflowSettings.BuildersetDeleteHistoryCondition(BooleanSupplier deleteHistoryCondition)Set the condition to be checked to decide if workflow instance history should be deleted.WorkflowSettings.BuildersetExceptionAnalyzer(BiFunction<WorkflowState,Throwable,StateProcessExceptionHandling> exceptionAnalyzer)Set the exception analyzer function.WorkflowSettings.BuildersetHistoryDeletableAfter(org.joda.time.ReadablePeriod period)Set the delay after which workflow history (actions, states) can be deleted from the database by nFlow.WorkflowSettings.BuildersetMaxErrorTransitionDelay(org.joda.time.Duration maxErrorTransitionDelay)Set the maximum delay on execution retry after an error.WorkflowSettings.BuildersetMaxRetries(int maxRetries)Set maximum retry attempts.WorkflowSettings.BuildersetMaxSubsequentStateExecutions(int maxSubsequentStateExecutions)Set maximum number of subsequent state executions before forcing a short transition delay.WorkflowSettings.BuildersetMaxSubsequentStateExecutions(WorkflowState state, int maxSubsequentStateExecutions)Set maximum number of subsequent state executions before forcing a short transition delay for given state.WorkflowSettings.BuildersetMinErrorTransitionDelay(org.joda.time.Duration minErrorTransitionDelay)Set the minimum delay on execution retry after an error.WorkflowSettings.BuildersetShortTransitionDelay(org.joda.time.Duration shortTransitionDelay)Set the length of forced delay to break execution of a step that is considered to be busy looping.
-
-
-
Method Detail
-
onAverageEveryNthExecution
public static BooleanSupplier onAverageEveryNthExecution(int n)
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
public static BooleanSupplier 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
public WorkflowSettings.Builder setMaxRetries(int maxRetries)
Set maximum retry attempts.- Parameters:
maxRetries- Maximum number of retries.- Returns:
- this.
-
setMaxSubsequentStateExecutions
public WorkflowSettings.Builder setMaxSubsequentStateExecutions(int maxSubsequentStateExecutions)
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
public WorkflowSettings.Builder setHistoryDeletableAfter(org.joda.time.ReadablePeriod period)
Set the delay after which workflow history (actions, states) can be deleted from the database by nFlow. Setting value tonullindicates that history is not deletable. Default is 45 days.- Parameters:
period- Delay after which history can be deleted.- Returns:
- this.
-
setDeleteHistoryCondition
public WorkflowSettings.Builder setDeleteHistoryCondition(BooleanSupplier deleteHistoryCondition)
Set the condition to be checked to decide if workflow instance history should be deleted.- Parameters:
deleteHistoryCondition- Function to be called.- Returns:
- this.
-
setDefaultPriority
public WorkflowSettings.Builder setDefaultPriority(short defaultPriority)
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
public WorkflowSettings build()
Create workflow settings object.- Returns:
- Workflow settings.
-
-