Activiti 7 Beta 2 comes with a new BPMN modeling application that we will have a look at in this article. It supports the BPMN 2.0 standard. It’s been developed with the help of the Alfresco Application Development Framework (ADF). The source code is availablehere.
Activiti 7 Deep Dive Article Series
This article is part of series of articles covering Activiti 7 in detail, they should be read in the order listed:
You have read and worked through the "Activiti 7 - Getting Started" article and the Activiti 7 Full Example is running
You are familiar with Business Process Model and Notation (BPMN) 2.0 and you have designed and created business processes before, maybe even with previous versions of Activiti. This article will not cover too much around how to design business processes with BPMN.
Running the Activiti Modeler Application
The Activiti deployment that we did in the previous article already got the modeler up and running. If you don’t have it running, then go back and start it up as per instructions in that article. You can access the modeler via thehttp://activiti-cloud-gateway.<IP>.nip.io/activiti-cloud-modelingURL. Login withmodeler/passwordas this user is part of the ACTIVITI_MODELER role, which have the rights to use the modelling capabilities, you should now see:
You might see an application if you created one the first time you accessed the modeler in the previous article.
Creating a Process Application
A process definition lives inside a so called Process Application. Let's create one that will contain our process definition. ClickCreate new | Applicationand give it a name and description:
ClickCreatebutton to create the new Process Application:
Now, click on the Sample App application to start modelling:
Creating a Process Definition
A Process Application can contain more than one Process Definition, so we need to create one before we start modelling the business process. Click on theCreate new | Processmenu item:
That should take you to a form where you fill in the name and description of the Process Definition:
ClickCreatebutton to create the new Process Definition:
Now, click on theSample Processin the left navigation to start BPMN 2.0 modelling:
We already got a start node on the canvas in the middle. Now let’s continue with the activities that we want for our sample process.
Let’s start by adding a new User Task, in the left toolbar select the rectangle with a person icon in it and then drag-n-drop theUser Taskonto the canvas. Call it User Task 1:
We want to assign the user task to a specific user (i.e. not the the initiator of the process instance). We got the following users in Keycloak that we can choose from:
Click on the user task on the canvas and then fill inAssigneeastestuserto the right in thePropertiespane, then click the check button after the field to save the assignee value:
Then drag-n-drop aService Taskonto the canvas after the User task and call it Service Task 1:
To implement the Service Task we use something calledCloud Connectors, they run as their own processes in their own containers, which means they can be scaled and managed separately from the process execution.
Cloud Connector implementations are specified with the standardimplementationproperty. Click on theService Task 1and then fill in the implementation property as follows with theserviceTask1Implvalue:
Theimplementationproperty value on the Service Task definition will be used as a Spring Cloud Stream channel destination name (on the bound middleware RabbitMQ). So we have to make sure the custom Cloud Connector that we will build in the next article creates a consumer bound to this name with thespring.cloud.stream.bindings.<channel>.destinationproperty value.
Now add anEndnode and thenSavethe whole process definition by clicking on the disk in the upper right corner. Also, make sure todownloadthe XML for the new process definition by clicking on the download button next to the save button.
Important, if the session timeout expired and you cannot save, then just download and then import the process definition when logged in again.
You might be used to working withprocess listeners and task listenersin previous versions of Activiti. Listeners are an Activiti extension to BPMN 2.0 that implement hook points inside a process definition which are triggered by events during process execution. In Activiti 7 we can implement “listener” functionality by listening to events emitted by the process engine. This is better for Cloud deployments as events are async and Activiti listeners are synchronous. We will have a look at how to implement event handlers in the next article when we implement a custom Cloud Connector.
Sample Process Definition BPMN 2.0 XML
The exported BPMN 2.0 sample process definition looks something like this (double check that you got the User task set up properly with assignee and the Service Task with the implementation attribute):