Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For more info regarding the Camunda API see: https://docs.camunda.org/manual/7.3/api-references/rest/

Kinvey Console

Current Akioma Kinvey console URL: https://kvy-eu3-console.kinvey.com/

From here, you can view/edit applications, services, custom endpoints/functions and test kinvey collections.

Kinvey Configuration

Kinvey Profile Configuration File

First, make sure kinvey cli is installed on your machine. If not, you can use the following command: npm install kinvey-cli

When deploying the Kinvey service locally, you need to have a config file in the current folder from which you are deploying the service. The file name will be '.kinevy'. This will be configured using the kinvey init command.

Once you run this command, you will need to supply your kinvey console credentials and the Kinvey instance ID (optional - in our case this is kvy-eu3).

Alternatively, if you already have a profile configure, you can use it with the command kinvey profile use.

Pasoe Config

In order to connect the application to to Kinvey, we need to set 3 session properties in the pasoe-config.xml file from the ofr-config project: kinveyAppSecret, kinveyInstanceId, kinveyAppKey.

The above 3 properties can be found by selecting an environment within a Kinvey App and clicking on the 3 dots:

Image Removed

After you set the properties in the file, restart the PASOE.

Kinevy Service/Functions

https://devcenter.kinvey.com/rest/guides/flex-services

https://devcenter.kinvey.com/rest/guides/flexservice-runtime

Kinvey Create/Deploy Service

Test collection - kinvey console command

Kinvey Collections

Kinevy collections are essentially data abstractions, representing a group of related data entities. They are defined in the Environment → Data → Collections tab:

Image Removed

To define a new collection, click on Add collection. Then, select the data service, environment and service for which you want to define a collection for. Finally, click on activate service.

Image Removed

Collections will be used to make data available in the application UI, in grids. This will be explained below.

Kinevy DSO Setup

After we set the Kinvey parameters in the pasoe-config.xml file and we define a kinvey collection, for the dataSource we can use the SimpleSwatBusinessEntity.

Here, we would need to set 2 attributes:

  • SUBTYPE : 'KinveyCollection' (without the quotes)
  • resourceName: name-of-camunda-collection

Then simply create a DATA link from the DSO to the grid and you should be able to see the collection data.

Kinvey Custom Endpoints

Custom endpoints are defined on the Application Environment settings. They can be called from the frontend using akioma.InvokeServerTask. A custom endpoint is linked to a service flex function. Essentially, when a custom endpoint is called, we are calling the the flex function defined in the service.

Custom endpoints can be defined on the application environment from the Business Logic → Custom Endpoints:

Image Removed

Click on the add new Endpoint button, give the new endpoint a name and select the Business Logic Type.

In our case, that is Microservice (Execute a handler function running inside a Flex Services Runtime service).

Once the endpoint is created, select the service, then environment and finally the handler function:

Image Removed

Kinvey Calling the Custom Endpoints

Calling a Kinvey custom endpoint is done using akioma.InvokeServerTask.

The only thing we need to specify is the methodType: "kinvey" in the request.

akioma.invokeServerTask({
       name: "completeTask", 
       methodType: "kinvey", 
       paramObj: { 
               id: "id-of-task"
       }
})


...

More information regarding Kinvey Flex Services here: Kinvey Flex Services

Code Block
languagejs
titleCamunda Service Example
linenumberstrue
const sdk = require('kinvey-flex-sdk');
const DigestFetch = require('digest-fetch');


Class CamundaService {

?? ?? ?? ?? constructor(){
?? ?? ?? ?? ?? ?? this.client = new DigestFetch(userName, password);
?? ?? ?? ?? ?? ?? this.logger = flex.logger;

}


getAll (context, complete, modules) {
?? ?? this.logger.info('getAll Context:' + JSON.stringify(context));
?? ?? const backendUrl = "url to camunda backend";
?? ?? this.client.fetch(backendUrl)
?? ?? ?? ?? .then(response => response.json())
?? ?? ?? ?? .then(data => {
?? ?? ?? ?? data.forEach(item => {
?? ?? ?? ?? ?? ?? item._id = item.id;
?? ?? ?? ?? });
?? ?? ?? ?? complete().setBody(data).ok().next();
?? ?? })
?? ?? .catch(e => console.error(e));
}

}

sdk.service((err, flex) => {
?? ?? ?? ?? const data = flex.data;?? ?? ?? ?? ?? ?? ?? ??//get data object
?? ?? ?? ?? const flexLogger = flex.logger;??//get logger

?? ?? ?? ????const camundaFlexServive = data.serviceObject('task');??//get service object from data object
?? ?? ?? ????camundaService = new CamundaService(key, flex);?? ?? ?? ??//instantiate new service class
?? ?? ?? ?? camundaFlexServive.onGetAll(camundaService.getAll.bind(camundaService)); //bind handler function to getAll event

}