When you design a process, BPMN elements such as call activities or BPM messages are useful to instantiate other processes, perform tasks in other processes, and so on.
These two kinds of BPMN elements are available in the Bonita Studio palette:
But when should you use a call activity vs a BPM message?
Both elements are used to communicate between processes, but in different ways.
A call activity calls and instantiates another process and the parent process will continue only when the other process is finished.
The process initiator in this case is the system user. Actors will only be defined to identify who will do tasks in the called process.
Messages allow asynchronous point-to-point communication between two different pools. To identify messages to each other, you will use key-based correlations.
Data can be mapped using both elements:
- to share data between parent and child process in call activities, by direct mapping or contracts.
- through the sending task or throw message event, by mapping the message content in the catch message event with process variables.
Call activity is key to readability, maintainability and reusability.
- Using call activity to push standardized sequences to child processes facilitates the readability of the parent processes.
- It is easier to maintain because if you don't specify the version of your called process, Bonita will automatically select the last deployed version.
- The called processes can be made mutual, and called by several processes, making them reusable. You can create a collection of standard processes or sequences to be called from parent processes.
Messages make it simple to communicate between any processes in a case.
As the communication is asynchronous, there is no need to return to the main process.
Messages can be used at any time in the process flow, to instantiate or end processes, and also within the process to define synchronization points.
And keep in mind...
Call activity
- Only use a call activity when a sequence can't be easily included in the parent process, as you will have to duplicate variables and create a new process instance.
- Remember to remove the initiator of the called process if you want to prevent any end-user to initiate the process and only grant this action to the call activity.
Messages
- Messages don't expire. Make sure they are consumed and you don't have any pending messages related to future correlations.
- A message IS NOT an email!
- Documents cannot be transmitted by message (you will have to use documentId or documentURL instead).