◷ Reading Time: 8 minutes
What is Workflow?
Workflow is a special type of flow that can go to many resumable intermediate states (i.e., Waiting, Suspended, etc.) at execution time before it goes to a completed state. This allows external actors to communicate with workflow and pass information as required before the workflow is completed on those intermediate states. A workflow may take a long time to be completed (i.e., long-running business transactions).
To allow an external actor (human or computer system) to communicate with workflow in different stages, FlexRule Runtime uses different types of nodes:
- Tasks (i.e., receive, human, etc.)
In those intermediate states, external actors (human, or system) will be able to communicate with Workflow and navigate based on the workflow model.
When a workflow goes into an intermediate state, the workflow instances will not stay loaded in memory. FlexRule tries to store the context of the instance in some storage and then keeps listening for related incoming events until it receives them. Then the engine will load the workflow instance and resume it from the last step.
A workflow must support long-running processes or business transactions. That means applications must maintain contexts of workflow in different stages of execution (i.e., run or resume). So, execution contexts must be maintained in durable storage, as a workflow may take a long time to be completed. An application should provide the relevant (latest) context to the engine when required in order to continue the Workflow (i.e., Resume).
A Workflow can be suspended temporarily during execution using a Pause step. This will put the Workflow into a Suspended state. Later on, the application can Resume the workflow and it will continue the execution onward.
A workflow can have as many Pause nodes as required. These can be placed between all different types of nodes (e.g., inside loops, after/before database calls, etc.).
Pause node to put the work in temporary state (Suspended)
Tasks are an advanced type of Pause nodes. A task puts the workflow instance in the Waiting state. In this state, the workflow can be awoken by receiving a Signal.
Tasks can be:
- Sequential: waiting for one signal at a time
- Parallel: waiting for multiple signals
The Receive task allows the workflow to be ‘Waiting’ for a signal to be received. That’s the simplest form of the task.
In this use case, a workflow is waiting for one signal at a time. Like any other activity in a flow, you can link multiple Receive Tasks to each other. In this case, the workflow goes into the Waiting state multiple times, but each time one Signal can be received.
Sequential Receive Task
You can use ListenerSplit to listen to multiple signals in parallel. When an associated signal is received, the workflow continues executing that path (i.e., Scope)
Waiting for multiple signals in parallel allows the application to provide options in a particular state. In the above example, the workflow goes to the Waiting state once and will be waiting for each Approve or Reject signal.
Allowing multiple options
A Timeout task allows waiting for a certain amount of time and then the workflow instance will automatically receive a signal to continue the execution.
An example of this is when you want to limit the response time for a Receive Task.
Timeout node must be used in the parallel scopes between Split and Join Listeners.
Timeout limits the amount of time workflow is waiting for either an approved or decline response
Human tasks are used in human workflows to define Work and enable the interaction of humans and systems. These automate computerized and non-computerized activities in a workflow. When a workflow reaches the Task node, it can create a WorkItem and Assign it to the participants of the Work.
Human tasks enable the modeling of complex human-driven workflows:
- Enabling outcome-driven modeling of a human interaction
- Defining the task’s Owner and Participants
- Assigning tasks to participants
- Setting tasks expiration policy
- Delegating tasks
- Defining escalation logic
- Allowing multi-participant interactions
- WorkItems application to allow working on and interaction with assigned tasks
Enabling the interaction of two individuals on publishing content.
To add a new Workflow document,
Document Types --> Business Logic --> Workflow
Once you added a term, this will be the window.
- Name: Name of the flow
- Variable Definition: Define variables to be used in the flow
- Types Definition: List of types and functions
- Glossaries: Link Business Glossaries and Boxed Expressions
- Swimlanes: Lanes that specify context and actors in a workflow
The toolbox has all the tools from Generic Flow and a number of additional nodes that can be added to the flow.
At the top menu, you can see the following items.
- Open the related logic document for this node: Open the logic document of a selected node
- Create a logic document for selected node: Create a logic document for a selected node
- Delete item: Delete a selected item
- Highlight the impacts of the selected node: Highlight the impacts of a selected node
- Properties: Properties of the page or a node
- Variable Parameters: Define/ update/ delete variables
- Business Glossary: Link Business glossaries and boxed expressions
- Overview of entire model: See the entire model
- Zooming: Zoom in or zoom out
- Export to image: Export the document to an image
- Alignments: Align nodes
- Resize: Resize selected nodes to a single size
- Layout arrangements: Automatically arrange and layout the nodes
- Change connections: Change connection styles to straight/ Bezier or Right Angle
Node/ Connection Properties
If you click on a node/ connection, its property window will appear. The properties vary depending on the node type.
Download the sample Workflow using the attachment.