public class WorkflowRetryAndContinue extends DefaultWorkflowLifecycleStrategy
This implementation allows you to retry the init and start for a given workflow a configurable number of times. Each workflow is attempted in sequence, and the failing workflow is retried until either it is successful or the max number of retry attempts has been reached. If the workflow has still failed at this point, it is simply skipped and any remaining workflows initialised or started.
Note that if you use this strategy then any configured AdapterLifecycleEvent
may be inaccurate.
In the adapter configuration file this class is aliased as workflow-retry-and-continue which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
WorkflowRetryAndContinue() |
WorkflowRetryAndContinue(java.lang.Integer max,
TimeInterval interval) |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
getMaxRetries() |
TimeInterval |
getWaitBetweenRetries() |
void |
init(java.util.List<Workflow> workflowList)
Initialise a list of channels.
|
void |
setMaxRetries(java.lang.Integer maxRetries)
Set the maximum number of retries.
|
void |
setWaitBetweenRetries(TimeInterval tu)
Set the wait between each retry attempt.
|
void |
start(java.util.List<Workflow> workflowList)
Start a list of workflows.
|
close, closeConsumers, stop, stopConsumers
public WorkflowRetryAndContinue()
public WorkflowRetryAndContinue(java.lang.Integer max, TimeInterval interval)
public void start(java.util.List<Workflow> workflowList) throws CoreException
WorkflowLifecycleStrategy
start
in interface WorkflowLifecycleStrategy
start
in class DefaultWorkflowLifecycleStrategy
workflowList
- a list of workflows that have already been initialised.CoreException
- wrapping any underlying exception.public void init(java.util.List<Workflow> workflowList) throws CoreException
WorkflowLifecycleStrategy
init
in interface WorkflowLifecycleStrategy
init
in class DefaultWorkflowLifecycleStrategy
workflowList
- a list of workflows that require initialising.CoreException
- wrapping any underlying exception.public java.lang.Integer getMaxRetries()
public void setMaxRetries(java.lang.Integer maxRetries)
Note that setting the maximum number of retries to be infinite will cause failling workflows to block other workflows from starting until they are successfully actioned.
maxRetries
- the max number of retries, if not set, defaults to 5. -1 means infinite retries.public TimeInterval getWaitBetweenRetries()
public void setWaitBetweenRetries(TimeInterval tu)
tu
- the wait between each retry attempt; if not explicitly set then defaults to 10 seconds.