BPM notations
Tags: camunda, beginners, workflowengine
Published: 2022-02-20 15:00:04

In previous article, we have used basic notations to create BPMN and learned about how to integrate REST API with BPMN. If you have not gone through yet, follow this link: 
https://dev.to/jeyaauthithan/integrating-rest-api-with-bpmn-4mph

At the end of this article, you will be able to get a better understanding on more BPM notations and how to start the process instance. 

Let’s get started!


## Notations:
<u>Send Task:</u>
Implementation of Send task is same as service task, only difference is the way we want to represent the symbols in our BPMN. For ex. If we are making external system calls, to make it precise that request is being send, Send Task can be used.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7cn376sx8yfjy12din79.png)

<u>Receive Task:</u>
In this task, BPMN is expected to receive the data from external system. Hence, whenever execution reaches this task, it waits till someone invokes it with the response. We can have more than one ‘receive’ task in the BPMN file. Each receive task will have its own unique message name to differentiate it from each other. External system can invoke the task by correlating to its message name.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbgqf6nxb7kn531z988d.png)
 
<u>User Task:</u>
This task specifies that we need some user inputs before proceeding with the workflow. When execution reaches this task, it waits till user completes the task with necessary inputs. This task can be completed via cockpit or internal REST API of Camunda engine.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0cr7jww2xw2ws6ldfas.png)

<u>Call Activity:</u>
Call activity can be used to invoke a BPMN within a BPMN process. It is
same as calling a method inside another method. If there are some BPMN process
which can be reused inside another BPMN, this call activity can be configured
with the called BPMN process id.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlnehakg8oo6ggcbxco0.png)
 
<u>Parallel Gateway:</u>
Using Parallel Gateway, we can have more than one sequence flows which
will be executed in parallel. This will split the flow into concurrent paths. The
paths are executed concurrently and independently.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fluq223ep9oieazy7eqm.png)

<u>Inclusive Gateway:</u>
This is combination of both exclusive and parallel gateway. The Inclusive Gateway represents the need to decide where all conditions must be evaluated. Whilst the Inclusive Gateway can be used to show that all paths must be taken, it should be used in such a way that at least one of the paths is taken.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k0w719maqe8q5kh89hz9.png)

<u>Pool/Participant and Lanes:</u> 
Pool/Participant can be used for orchestrating the process. We can write BPMNs without Pools and lanes as well. In cases where we want to have clear view and step by step segregation of activities/tasks, we can make use of this. We can add as many lanes as we want in a pool.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0belenuh704x52dmpuh.png)

  Process using pools and lanes:
       ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/61svabnegt4ccvjls8um.png)

<u>Embedded subprocess:</u>
This allows us to group elements of the process. Few scenarios where we can make use of this:
• When we need to run set of tasks in loop
• When we need to use Boundary events (will see about Events in detail in next article).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4wx09vt1zswc4dlcqgn.png)

  Process using embedded subprocess:
      ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cecz3w8ygmk4utb7rrg7.png)

## How to start process instance:
 As in previous article, we learnt how to deploy BPMN process, lets see how to start the process execution.

- Find your process Id by opening the BPMN in the Camunda modeler and check “id” field in properties panel.

- Start the spring boot application and call below end point with the process id. This is internal REST end point exposed by Camunda engine.
   Method: POST
   URL: http://localhost:8080/service/demo/rest/engine-rest/process-definition/key/ProcessId/start

Viola! This will create process instance for your process.

Once process instance started, all the tasks will be executed and if no failures, process instance will end. 

 Let’s add wait task to our BPMN and check the process execution via cockpit:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/algze3nbbrconf94nftt.png)

Deploy this process in the engine and start the process instance.
In Cockpit, we can see the process instances which is waiting for user action.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hkrtjuslyj8zekz7x3oc.png)

On click of process instance id highlighted above, we can see variables stored in the process instance.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5jnjda6cw6s08wjjyve.png)

Let’s complete the wait task and progress the process instance.

In above screen, navigate to User Tasks tab, click on the taskId and it will get you to the Camunda tasklist screen.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d1qr8m905byo604d6dsn.png)
 
In this screen, on click of Claim button, complete button will be enabled. Click on complete button and we can see process instance getting completed.

Hope you understood more notations used in BPMN and how to start the process instance in this article. 

Try creating BPMN with the notations you have learned so far and start the process instance and check out the behaviour. Drop a comment in case of any queries. 

Let’s learn about Events and error handling in next article.

Happy Learning! 😊