Interface SimpleWorkflow
- All Known Implementing Classes:
SimpleWorkflowExecution
public interface SimpleWorkflow
Prescribed interface for representing an ordered list of business tasks (
SimpleActivity
).
Responsible for launching execution of activities at any point in the list. Also, responsible for
exposing queryable information about the workflow, including execution history and metadata about
workflow contents. See SimpleWorkflowExecution
for concrete implementation.-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Whether requesting a previously executed step (prior to the last step) ingoToStep(String)
is allowed.default boolean
Whether requesting the most recently executed step ingoToStep(String)
is allowed.void
cancel
(boolean fail) Cancel execution once the currently running activity (if any) finishes.void
Execute a list ofSimpleActivity
members identified by their names at the position identified by the activity whose name matches the name parameters.The current activity that is running in the workflow.A human-readable description for this workflow.Return the list of start and end times, status, and possible failure information for allSimpleActivity
executions that have occurred.getMap()
Return the map of metadata defining order and identifying information about all containedSimpleActivity
members.getName()
The unique name for this workflow.getNextStep
(String lastStep, String lastResponse) Given a previous step and response (seeActivityResponse
), determine what the next step should be in the workflow.getSteps()
Retrieve the ordered list of names for all the activities supported by this workflow.void
Signal the workflow to circumvent normal execution ordering and skip forward or backward to the position where theSimpleActivity.getName()
matches the supplied name.void
pause
(boolean autoRestart) Stop execution once the currently running activity (if any) finishes.void
shutdown()
Stop a running workflow.void
Start execution of the list ofSimpleActivity
items at the first position.
-
Method Details
-
shutdown
void shutdown()Stop a running workflow. Generally called at JVM shutdown in case the workflow is still running. Gives the workflow a chance to clean up and pause before exit. -
start
Start execution of the list ofSimpleActivity
items at the first position.- Parameters:
context
- Any information that needs to be supplied to one or more activities- Throws:
WorkflowCancelException
- thrown when a cancellation signal is detected at runtimeWorkflowPauseException
- thrown when a pause signal is detected at runtime
-
goToStep
Signal the workflow to circumvent normal execution ordering and skip forward or backward to the position where theSimpleActivity.getName()
matches the supplied name. The signal is honored once the currently running activity (if any) finishes.- Parameters:
name
- The name of the activity to match in order to identify the starting point
-
cancel
void cancel(boolean fail) Cancel execution once the currently running activity (if any) finishes.- Parameters:
fail
- Whether to mark the workflow as failed. If false, the workflow will be marked completed.
-
pause
void pause(boolean autoRestart) Stop execution once the currently running activity (if any) finishes.- Parameters:
autoRestart
- Whether to mark the workflow as available for automatic resume. If true, hints to the system infrastructure that it should resume processing of this workflow at the next available processor.
-
getMap
SimpleOrchestrationMap getMap()Return the map of metadata defining order and identifying information about all containedSimpleActivity
members.- Returns:
- The map of metadata defining order and identifying information
- See Also:
-
getHistory
History getHistory()Return the list of start and end times, status, and possible failure information for allSimpleActivity
executions that have occurred.- Returns:
- The list of start and end times, status, and possible failure information
- See Also:
-
execute
Execute a list ofSimpleActivity
members identified by their names at the position identified by the activity whose name matches the name parameters. Also, provide the context information to pass to the workflow execution.- Parameters:
steps
- List ofSimpleActivity
member namestarget
- The activity that represents the starting point in the list. Optional. Start at the first position if null.context
- Any information that needs to be supplied to one or more activities- See Also:
-
getNextStep
Given a previous step and response (seeActivityResponse
), determine what the next step should be in the workflow. Workflow execution is dynamic in this regard based on decision criteria registered as part ofStep.getDecisions()
.- Parameters:
lastStep
- The name of the previous step to executelastResponse
- The response value from the previous step to execute- Returns:
- The name of the next step that should execute
-
allowHistoricalReset
default boolean allowHistoricalReset()Whether requesting a previously executed step (prior to the last step) ingoToStep(String)
is allowed. This is different from retry, which is an attempt to re-execute the most recent historical activity.- Returns:
- Whether requesting a previously executed step (prior to the last step) is allowed
-
allowRetry
default boolean allowRetry()Whether requesting the most recently executed step ingoToStep(String)
is allowed.- Returns:
- Whether requesting the most recent executed step is allowed
-
getDescription
String getDescription()A human-readable description for this workflow. Generally also unique like the name to ensure clarity in the admin UI.- Returns:
- A human-readable description for this workflow.
-
getSteps
Retrieve the ordered list of names for all the activities supported by this workflow. The names should match Spring bean names for each, asSimpleActivity
implementations use Spring as the bean factory for retrieval of instances.- Returns:
- The ordered list of names for all the activities supported by this workflow
-
getName
String getName()The unique name for this workflow. Should match the Spring bean name for the workflow bean.- Returns:
- The unique name for this workflow.
-
getCurrentActivity
String getCurrentActivity()The current activity that is running in the workflow.- Returns:
- The current activity that is running in the workflow.
-