Flowable Fundamentals
Basic Components of Flowable
Flowable is composed of several basic components that form the logic of workflows:
Cases
Use the structure of CMMN (Case Management Model Notation). In summary, each case consists of one or more phases, with each phase composed of one or more processes.
Processes
Use the structure of BPMN (Business Process Management Notation). These are the actual workflows in flowchart format, always containing a start event and an end event. Tasks can be executed between these events.
Tasks
Actions that must be performed by human interaction or automation. They comprise a significant part of processes. Tasks can be:
- User Tasks: Tasks requiring human interaction, such as filling out a form, clicking a button, or performing another predefined action.
- Service Tasks: Tasks using a service, such as a web service call or an automated application, not requiring human intervention.
Flowable includes additional task elements for specific functions (e.g., Camel tasks, HTTP tasks, mail, business rules, scripts, etc.). For conceptual descriptions, all these can be considered Service Tasks.
Gateways (Decision Gateways)
Decision Gateways create alternate decision paths in a flow and are represented by a diamond. Flowable uses exclusive gateways, meaning only one path is chosen among alternatives, represented by a diamond with an “X” in the middle.
Process Flows
Process Flows are the “arrows” connecting elements in a workflow, always having a source and a destination.
Events
Events can be either catching (inbound) or throwing (outbound):
- Catching: When a process reaches an event, it waits for a trigger.
- Throwing: When a process reaches an event, it sends a trigger.
BPMN can send information via payload (JSON or XML) to an external process or phase (outbound) or receive external information to perform an action (inbound), always tied to an event.
BPMN 2.0 Constructs in Flowable
Flowable allows the construction of BPMN 2.0 workflows and includes custom extensions outside the BPMN 2.0 specification to simplify some structures for easier development.
- Complete documentation on BPMN definitions, Flowable extensions, and syntax is available here: Flowable BPMN Constructs Documentation.
In this documentation, we reference frequently used Flowable elements for modeling workflows in the Looplex environment. We recommend reviewing the documentation for available events and using it as a comprehensive guide for BPMN 2.0 annotations.
1. Signal Events
Signals are events broadcast globally to the system, triggering all processes observing them. You can link a signal to a specific execution instance by passing a custom Flowable parameter (flowable:scope="processInstance"
).
In this example, after manually approving the conditions of a new policy, a signal event is emitted, indicating a change. This event is outward-facing (broadcast).
The transmitted signal is captured by other processes with a corresponding capture event.
2. Message Events
Message events refer to a specific message containing a name and a payload, addressing a single recipient.
Above is an example of message events that can initiate a process through alternate paths.
3. Error Events
Events representing errors, either catching (inbound) or throwing (outbound), are depicted with an error icon and can mark process start or end points.
4. Boundary Events
Boundary events are intermediate catching events linked to an activity. While the activity runs, the event “listens” for a specific trigger. When captured, the activity is interrupted, and the flow proceeds from the boundary event.
In the example above, a Timer Boundary Event triggers after the activity starts, interrupting the activity when the specified time elapses, redirecting the flow.
- Interrupting Boundary Event: Solid lines.
- Non-interrupting Boundary Event: Dashed lines.
5. Compensation Boundary Events
Compensation Boundary Events are intermediate events executed as many times as the associated activity was performed. For example, canceling a reservation is executed for each reservation made.
Integration Tasks
Flowable includes a variety of pre-configured tasks to facilitate integration with other technologies, deviating from the BPMN 2.0 standard. These tasks allow convenient workflow integration with external services (e.g., email, HTTP requests, Camel Apache, Mule, Java, Shell, Scripts, External Worker).
Using REST APIs, many integrations can be conducted via Service Tasks and their variations. Below are examples:
Message Task
A Service Task that captures parameters for the workflow via a message request.
To configure this task:
Process Scope:
- Message definition: ID and name of the message element.
Task Scope:
- ID: ID of the message task.
- Message reference: ID of the process scope message definition.
- Name: Task name.
Trigger the task by sending a message to the workflow via the Flowable REST API (e.g., Message Starter Task):
- Endpoint:
http://localhost:8088/flowable-rest/service/runtime/process-instances
- Payload: JSON with the
message
property matching the message definition name.
HTTP Service Task
This task allows the workflow to make an HTTP request to an external service (e.g., API) and utilize the retrieved data. Configure a preceding Script Task to organize variables for the HTTP request:
In the Script Task example:
- Script format: Groovy.
- Script: Defines variables like
requestUrl
(API endpoint) andrequestHeaders
(accepts JSON).
Parameters for the HTTP Service Task:
- Request method:
GET
. - Request URL:
${requestUrl}
. - Request Headers:
${requestHeaders}
. - Response Variable Name:
myPayload
.
In this example, the GET method retrieves information from the REST API. Variables created in the Script Task are used for Request URL and Headers. The response is stored in a variable for subsequent workflow steps.
Flowable API
Flowable’s well-documented API is available at: Flowable API Documentation.
The official documentation includes Flowable API endpoints, presented in Swagger format for familiarity. Interact, create, send, and retrieve workflow values directly via the REST API:
Postman Flowable REST API Collections
Below are Postman collection files for working with Flowable REST APIs:
- Flowable App REST API.postman_collection
- Flowable CMMN REST API.postman_collection
- Flowable Content REST API.postman_collection
- Flowable CORE REST API.postman_collection
- Flowable DMN REST API.postman_collection
- Flowable Event Registry REST API.postman_collection
- Flowable External Worker Job REST API.postman_collection
- Flowable Form REST API.postman_collection
- Flowable REST API.postman_collection