BPMN in Action: Communicating With an External System Using RPA

In this post, I describe another example of the interaction between executable processes and Robotic Process Automation (RPA). The last post was about an RPA bot starting a process and transferring data from an Excel file to it. In today’s example, a bot is to carry out a task within a process and transfer data to an external system.

The external system used here is „Odoo“, a comprehensive business software. As there is no suitable connector in the Bonita BPM system for calling this software, the bot logs into the system like a human and enters the data via the user interface.

As RPA system I use Microsoft Power Automate Desktop again. In a similar example developed some time ago, I had used the RPA system UI-Path. Since UI-Path provides a REST interface, I just called the bot via this interface. Unfortunately, it turned out that the free version of Power Automate Desktop does not have a suitable interface.


BPMN in Action: An RPA Bot Starts a Process

I created this example of a connection between an executable BPMN process and RPA (Robotic Process Automation) some time ago. As described in this blog post, I had connected the BPM system „Bonita“ with the RPA system „UIPath“. Over time, new versions have been released and my examples no longer work with the current UIPath version. Since the handling of UIPath is a bit cumbersome if you only want to implement one or two mini-examples, I have now used the free version of Microsoft Power Automate instead. This makes it quite easy to create simple automations that should only run on your own desktop. There are some restrictions in the free version, but these are not problematic for the example presented here.

In the scenario under consideration, orders that are provided in the form of Excel files are to be handled by an executable process. To do this, it is necessary to transfer the data from the Excel file into the process. Without RPA, the data would have to be entered manually. This task is now performed by the bot. It reads the Excel file, converts the data into a suitable structure, logs into the BPMS, starts the order handling process and hands over the order data.


BPMN in Action: Which event wins?

Most BPMN models contain splits in the control flow. Most frequently used is probably the exclusive gateway. Such a gateway decides which way to go – based on data, such as the value of an order. An event-based gateway, on the other hand, decides on the basis of events. This gateway waits for several events to occur. The event that occurs first, „wins“ – and the path of this event is selected.

The process presented in the video contains a typical example of how to use an event-based gateway. At the gateway, the process waits for a message to arrive. If it isn’t received within a certain time span, a reaction is triggered, such as reminding the partner of the overdue message.

Unfortunately, the BPM-system Bonita – which is used for creating the examples in this series – doesn’t support event-based gateways. The video shows how to achieve the same behavior in a different way.

Link to the video


BPMN in Action: When to Use Multi-Instance Activities?

A BPMN activity marked with three small lines, is a multi-instance activity. As the name already indicates, such an activity can be performed several times. Other than with a loop, you don’t need to carry out the activity instances one after the other, until a certain condition is fulfilled. Instead, a multi-instance activity is performed for each element of a list. This can be done in parallel, i. e. in any arbitrary order, or even simultaneously (e. g. by different users).

The video shows an example with an order that contains several line items. Each line item is inspected separately. You can download the model and execute it in the free community edition of Bonita.


BPMN in Action: Process Communication via a Message Queue

In the last post I have shown how a process running on a process engine can communicate with a second process that is installed on a different process engine. For the communication, the REST interface of the second process engine was used. Since there isn’t any standard for process engines‘ REST interfaces, the calls must be adapted to the specifics of the second engine’s interface.

A more flexible approach is the use of a message queue (MQ). Such a message queue ist provided by a message broker. The involved processes communicate by inserting and removing messages from a queue. With this approach it is easier to exchange one of the process engines with a different engine. It is even possible that a process communicates with an entirely different system, such as an ERP system. For this example, a small Java class has been written that is used as a replacement for the second process.


BPMN in Action: Collaboration of Two Process Engines

In the previous post I have shown how to model separate BPMN processes that communicate using message flow. In order to execute such a process collaboration, all processes need to run in the same process engine. However, if you have processes from different business partners with their own BPM systems, the processes are executed in different process engines.

The video shows how to implement the communication between processes in different systems, using a REST interface. One of the processes is executed in Bonita, the other one in Camunda. The Bonita process exchanges messages with a support process that handles the communication with the Camunda process via Camunda’s REST interface.


The following zip file contains the Bonita project file as well as the BPMN process for camunda.


BPMN in Action: Process Collaboration & Message Flow

A special feature of BPMN compared to other process modelling notation is the possibility to model process collaborations. A collaboration consists of two or more separate processes that communicate via message flow. A process can send a message that starts another process, or a message is sent to an existing process instance that has already been waiting for this message at a message-catching intermediate event.

It is common to use collaborations for modelling the interactions between different business partners, e. g. between the procurement process of a customer and the order handling process of a supplier. However, business partners usually don’t use a shared BPMS platform. Does it also make sense to use collaborations within a single organization – although the same behaviour could be achieved by modeling a single process with several lanes?

The answer is yes, since the separation into different processes supports loose coupling, process re-use and separation of concerns.

The video presents a model of a collaboration and its execution by a processes engine. It also shows how to use a correlation in order to make sure that messages are received by the correct process instances.


BPMN in Action: Subprocesses/Call Activities

What happens in the execution of a BPMN process, when an activity is reached that is marked with a small plus-symbol (+)? The plus-symbol indicates that the activity has another, detailed BPMN model attached. When the activity is reached, the process engine starts executing the attached model. When this detailed process is finished, the execution of the main process continues.

BPMN distinguishes between „real“ subprocesses and call activities. A subprocess is part of the top level process and can directly access its data. A call activity, on the other hand, calls a separate process. Therefore it is necessary to specify the data to be transferred to this process, as well as the data to be returned to the top level process.

Other than subprocesses, independent processes can be called by different call activities in different processes. Therefore it is possible to re-use processes with the help of call activities.

Since call activities are more flexible, some BPM systems don’t support subprocesses as a separate concept. The example in the video also contains a call activity.


BPMN: Inclusive Gateways Must Be Clever

In the previous post I have shown how the three most important gateway types behave when they are executed by a process engine. The inclusive gateway is very flexible. At an inclusive split, one or more exits can be selected. A corresponding inclusive merge waits until all selected paths have been completed.

However, what happens when there is another splitting gateway in one of these paths, so that in some cases the inclusive merge may not be reached via this path anymore? In order to ensure that such processes do not get stuck, inclusive gateways must be clever, since they need to determine via which paths they still can be reached.

In order to test this behavior, i have inserted a splitting exclusive gateway in the previous example.


BPMN Gateways in Action

It is hard to find a serious BPMN model without any splits in the control flow. Splits are modeled with gateways, represented by diamond symbols. The following video shows three variations of a little example process. First, we use an exclusive gateway in this process, then a parallel gateway, and finally an inclusive gateway. The execution of each process variant shows the different behaviours of the three gateway types.

If you want to try out these examples for yourself, you can download and execute them, using the community edition of the „Bonita“ platform.