Examples of BPM Engine

EN | ES


In this guide we are going to illustrate some examples of BPMN processes in order to cover some use cases.


RELEVANT RESOURCES

Business Process involving user forms with user tasks 

Resources:


We are going to create a process that starts with a custom embebed form (start-form.html) which asks the user to introduce its age. When submitted, a manager of the process has to approve the request by submitting another form (task-form.html). Lastly, there is a gateway that forks the process flow depending on the input age (<=21 or >21).

Both forms are referenced in their respective tasks. The first form is referenced in the start event:
The second one is referenced in the 'Approve customer' task:
This forms have to be deployed along with the .bpmn process. To do this you can use the REST API as follows:(Remember the Authorization header with the onesait platform bearer token)
Anyways, this process is already available as an example by default in the BPMN Engine.To start the process you can either use the REST API or go the tasklist camunda web application via Controlpanel.REST APIThis will be demonstrated in the next process example (MSO).

Camunda Tasklist Webapp

Go to BPMN Tenants and click on 'View it'.
You will be redirected to the camunda web app, then click in 'Tasklist'.

Then, on the top bar, right side, click on 'Start process' and select 'Customer Data Process'.






The form will be prompted, fill it and click on start.

The process will be triggered and a new task will appear in the task list.
You can claim it and approve the request.

Finally, the process will stop at task 'Over 21', claim and complete it! 



Business Process involving Microservice Orchestration (MSO)

Resources:


The process basically accepts or refuses a payment operation. This involves the validation of a token (credit card) and available balance.In this process we are going to orchestrate some microservices/API calls. The flow implements the following logic:

  • The process starts with two parameters: token and quantity for the operation. The token parameter is associated with a credit card in other database, and the quantity is the amount of credit to be used in the operation.
  • The token is validated by calling microservice A which returns the credit card number associated.
  • If credit card number is retrieved, then balance for this bank account is retrieved (microservice B), and if the balance is greater than the quantity, the process accepts the payment operation, otherwise it is refused.
  • Lastly, a transaction is made to the microservice C, as a POST request.

This example is also available by default in the BPMN Engine, but you will likely have to change the urls of the http connectors.

Service Tasks (REST API calls)

The three main service tasks implement an http connector to make the calls. This connector is configured within the task configuration, selecting Details>Implementation>Connector.Then a new tab will appear to set connector parameters.
In the headers we set the Content-type, Accept, Authorization, etc.The method is the HTTP Method.The url is the url of the REST API.The payload (optional) is the body of the request. When you happen to need to send JSON payloads, use Parameter Type Script to make use of the Spin Plugin.
We are going to start the process via Camunda REST API.First you need to know the process definition ID. You can retrieve it by making the following request.(Remember the Authorization header with the onesait paltform bearer token).

To start the process, make the following request with input parameters (token & quantity) in the request body.

As this process doesn't have any user tasks, it will finish and you will have in the response the variables created along the process execution: