Platform Connectors for the BPM Engine

Available since Release 6.0.0

Introduction

In this release we have created a connector for the Platform BPM Engine, which will allow interacting with the rest of the platform elements, allowing:

  • Make queries on Entities

  • Perform insertions on Entities

  • Invoking APIs published in the API Manager

  • Invoke Dataflows

How does it work?

The connector is based on Camunda Templates, which allows us to use them in a Camunda BPMN diagram. The operation of the templates is explained below.

When creating a Camunda diagram, when selecting an element an option will appear in the Template side menu.

image-20240223-103358.png

When you select the + Select button, a list of templates available for that type of element will appear. In this list, the different platform connectors will appear, which allow us to:

  • Make queries Entities

  • Make insertions about Entities

  • Invoke published APIs in the API Manager

  • Invoke Dataflows

image-20240223-103618.png

Once the corresponding template has been selected, the properties that the element needs to connect with the Platform will be automatically loaded and the user will have to fill out for correct operation:

How to get data from an Entity?

You will have previously had to create the Entity you want to consult and associate it with a Digital Client of the Platform in order to obtain a token with which to access the data.

To get the data of an Entity we have to select the Onesait Platform Query template

Let's see how this template works with the following example:

  • buildQuery: Service Task of type Java class that dynamically constructs the where clause of the query that we are going to launch against the entity and stores it in the where variable.

  • getCustomers: Service Task that implements the Onesait Platform Query template and performs the query against the desired entity. There are several things to observe in the configuration:

    • How the where variable is collected in the Query field in a parameterized manner, which allows launching dynamic queries. If you want a static query, just enter the query without further ado.

    • The Platform enviornment field is optional; if not specified, the endpoint of the environment in which the process has been deployed will be used.

    • The result of the query is stored in the platformInstances variable and will generally always be a JSON array.

  • customerAge: evaluates the platformInstances variable and checks the age field with the following expression

${platformInstances.elements().get(0).prop("customer").prop("age").numberValue() >= 18}
  • over/under 18: User Task that waits for a user action.

View process execution

Once the process is deployed in the BPM Engine, we can launch it and we will see the following:

  • The data from the Entity query appears in the platformInstances variable in JSON format

  • Dynamically created where clause stored in where variable

  • By inspecting the platformInstances variable we can verify that the data that matches the where clause has actually been brought.

  • The JSON has been evaluated and the process is stopped at over 18, which agrees with the data obtained from the entity.

Below we leave the BPMN of the example:

How to insert data into an Entity?

You will have previously had to create the Entity you want to consult and associate it with a Digital Client of the Platform in order to obtain a token with which to access the data.

To insert data from an Entity we have to select the Onesait Platform Insert template

Let's see how this template works with the following example:

  • getData: Service Task of type Java class that dynamically constructs the data that you want to insert into the entity in JSON format and stores it in the data variable.

  • insertTask: Service Task that implements the Onesait Platform Insert template and inserts the data into the desired entity. There are several things to observe in the configuration:

    • How the data variable is collected in the Data field in a parameterized manner, which allows dynamic insertions to be launched. If you want to insert static data, simply enter the JSON in this field.

    • The Platform enviornment field is optional; if not specified, the endpoint of the environment in which the process has been deployed will be used.

    • The result of the insertion is stored in the platformIds variable, where we will have the IDs of the inserted instances.

  • doSomething: User Task that waits for a user action.

View process execution

Once the process is deployed in the BPM Engine, we can launch it and we will see the following:

  • The data of the insertion in the Entity appears in the platformIds variable in JSON format

  • Dynamically created data stored in data variable

Below we leave the BPMN of the example:

How to launch a Dataflow?

To launch a dataflow we have to select the Onesait Platform Dataflow template

Let's see how this template works with the following example:

  • launchDataflow: Service Task that implements the Onesait Platform Dataflow template and launches the desired Dataflow. There are several things to observe in the configuration:

    • The Platform enviornment field is optional; if not specified, the endpoint of the environment in which the process has been deployed will be used.

    • The parameters field is optional, in the event that the dataflow to be launched requires some parameter, it can be indicated to the BPM in this field in JSON format. It can also be parameterized with the nomenclature ${parameters} if we want the data to be mounted dynamically.

    • The result of the dataflow execution is stored in the dataflowResponse variable.

  • doSomething: User Task that waits for a user action.

View process execution

Once the process is deployed in the BPM Engine, we can launch it and we will see the following:

 

  • The result of the dataflow execution is stored in the dataflowResponse variable in JSON format

  • If we inspect the dataflowResponse variable we see that the dataflow has been started correctly

Below we leave the BPMN of the example:

How to invoke a Platform API?

To launch an API we have to select the Onesait Platform API template

Let's see how this template works with the following example:

  • launchAPI: Service Task that implements the Onesait Platform API template and launches the desired API. There are several things to observe in the configuration:

    • The Platform enviornment field is optional; if not specified, the endpoint of the environment in which the process has been deployed will be used.

    • The API Path field must follow the following nomenclature /<version>/<api_identification>/<operation_path>. In the example we see how part of the path is parameterized with the expression ${name}

    • The Body field is optional. If you want to launch an operation with a body, you can indicate it to the BPM in this field in JSON format. It can also be parameterized with the nomenclature ${body} if we want the data to be mounted dynamically.

    • The result of the dataflow execution is stored in the apiResponse variable.

  • doSomething: User Task that waits for a user action.

View process execution

Once the process is deployed in the BPM Engine, we can launch it and we will see the following:

 

  • The result of the dataflow execution is stored in the apiResponse variable in JSON format

Below we leave the BPMN of the example:

Â