Common Understanding Wiki

Common Understanding Wiki

A Common Knowledge Source of Terms and Definitions

Workflow Engine...

API specification

Wiki: BPaaS Tools

API specification

We have extended the Activiti API, so you can find more information in the following link Activiti REST API


Deployment Phase

  • Create a new deployment (dinamic service tasks):
    POST repository/deployments
    

The request body should contain data of type multipart/form-data. There should be exactly one file in the request, any additional files will be ignored. The deployment name is the name of the file-field passed in. If multiple resources need to be deployed in a single deployment, compress the resources in a zip and make sure the file-name ends with .bar or .zip.

Two additional parameters (form-field) can be passed in the request body:

  • tenantId: it is the id of the tenant that will be associated to the deploy business process.
  • endPointServiceList: It is the list of the actual URL (IP/host_name and the port) of the associated services. The parameter has to have the following structure:
EndPointServiceBundle: contain all the necessary information to modify the bpmn with the actual service IPs
  • workFlowId(literal): Identify the workflowId (set as "id" attribute on process element)
  • workFlowName(literal): Set a workflow name (set as "name" attribute in process element)
  • endPointServices (EndPointServices[]): list of the actual IPs of services, it is described by the EndPointServices entity.
EndPointServices: Include the details to identify the services and contains the real IP.
  • serviceId (literal): identification of the services.
  • type (literal): Only accepted two values: WS (Web services) and REST.
  • serviceTaskId (literal): Indicate the identifier of the service task, associated to this serviceId. It is optional since there are some situation where the description of the services are not associated directly to the service task.
  • Ip (literal): It indicates the IP/Name of the host plus the port, following the pattern <ip/host_name>:<port>. If the port is 80 o 443 it is not necessary to include them in this attribute.

Example of the json file:

{
   "workFlowId":"wf1",
   "workFlowName": "a name",
   "endPointServices":[
      {
         "serviceId":"http://localhost:8080/demo-app-1.0/services/cardDesigner?wsdl",
         "serviceTaskId":"",
         "type":"WS",
         "ip":"127.0.0.1:8080"
      },
      {
         "serviceId":"http://localhost:8080/demo-app-1.0/services/email?wsdl",
         "serviceTaskId":"",
         "type":"WS",
         "ip":"127.0.0.1:8080"
     }
   ]
}

Note: Change the ip attribute with the available Web Service definition (running WSDL description), if not the WorkflowEngine doesn’t allow to deploy the BPMN file. Response codes:

*201    Indicates the deployment was created.
*400    Indicates there was no content present in the request body or the content mime-type is not supported for deployment. The status-description contains additional information.

Success response body:

{
    "category": null,
    "deploymentTime": "2015-10-30T15:21:42.711+01:00",
    "id": "40",
    "name": "withEmail.bpmn20.xml",
    "tenantId": "ATOS",
    "url": "http://127.0.0.1:8080/activiti-rest/service/repository/deployments/40"
}


Execution Phase


  • List of instances
    GET service/runtime/process-instances?deploymentId=<deployemtId>
    

This action obtains all the process instances associated to one deployment.

The following parameters need to be indicated:

  • deployemtId: the identifier of the deployment in order to obtain its instances.

Response codes:

*200    Ok.
*400    Indicates there was no content present in the request body or the content mime-type is not supported for deployment. The status-description contains additional information.

The response message contains the list of instances with the UrL parameters, in this case all the instances for the specific deployment (deployemtId)

Example of the response, list of instances:

{
    "data": [
        {
            "activityId": "sid-2B0D606E-2AF8-4EF6-AFF0-E137471C6990",
            "businessKey": null,
            "completed": false,
            "deploymentId": "152501",
            "ended": false,
            "id": "152505",
            "processDefinitionId": "CloudSocketSendingInvoicesFinal_withTokenActiviti:1:152504",
            "processDefinitionUrl": "http://localhost:8080/activiti-webapp-rest2/service/repository/process-definitions/CloudSocketSendingInvoicesFinal_withTokenActiviti:1:152504",
            "suspended": false,
            "tenantId": "",
            "url": "http://localhost:8080/activiti-webapp-rest2/service/runtime/process-instances/152505",
            "variables": []
        },
        {
            "activityId": "sid-2B0D606E-2AF8-4EF6-AFF0-E137471C6990",
            "businessKey": null,
            "completed": false,
            "deploymentId": "152501",
            "ended": false,
            "id": "152515",
            "processDefinitionId": "CloudSocketSendingInvoicesFinal_withTokenActiviti:1:152504",
            "processDefinitionUrl": "http://localhost:8080/activiti-webapp-rest2/service/repository/process-definitions/CloudSocketSendingInvoicesFinal_withTokenActiviti:1:152504",
            "suspended": false,
            "tenantId": "",
            "url": "http://localhost:8080/activiti-webapp-rest2/service/runtime/process-instances/152515",
            "variables": []
        }
    ],
    "order": "asc",
    "size": 2,
    "sort": "id",
    "start": 0,
    "total": 2
}


  • Adaptation for one process instance
    POST service/runtime/process-instances/<instanceId>/adaptation
    

This action allows to modify de endpoints of the service tasks for the instance indicated, for example, if the adaptation engine realizes that something happens through the Cloud Provider Engine could call the WF engine to modify the conditions The following actions are included in order to configure the new environment:

  • Suspend the instance.
  • Base on this instance recover the associated deployment and obtain the original BPMN file.
  • Base on this original BPMN, the system parses the new endpoints (detailed in a json message), besides, we can change the id and name of the new workflow definition (introducing the appropriated attributes in the json ).
  • Create a new deployment with the new BPMN applying the new conditions and change the name of the process definition accordingly with the id of the new workflow.
  • Obtain the new process description (associating to his new deployment)
  • Update the instance with the new process description.
  • Active the instance again.

The following parameters need to be indicated:

  • InstanceId: this id of the instance. It is indicated in the URL when the call is created.
  • endPointServiceList: It is the list of the new URLs (IP/host_name and the port) of the associated services. The parameter has to have the following structure:
EndPointServiceBundle: contain all the necessary information to modify the bpmn with the actual service IPs
  • workFlowId(literal): Identify the new workflowId after the adaptation. If it is not indicated, the system maintain the previous id + “_adaptation”
  • workFlowName(literal): Set the new workflow name (set as "name" attribute in process element) after the adaptation. If it is not indicated, the system maintain the previous name + “_adaptation”
  • endPointServices (EndPointServices[]): list of the actual IPs of services, it is described by the EndPointServices entity.
EndPointServices: Include the details to identify the services and contains the real IP.
  • serviceId (literal): identification of the services.
  • type (literal): Only accepted two values: WS (Web services) and REST.
  • serviceTaskId (literal): Indicate the identifier of the service task, associated to this serviceId. It is optional since there are some situation where the description of the services are not associated directly to the service task.
  • Ip (literal): It indicates the IP/Name of the host plus the port, following the pattern <ip/host_name>:<port>. If the port is 80 o 443 it is not necessary to include them in this attribute.

Example of the json file:

{"workFlowId":"WP3_test_Final_AfterAdaptation",
"workFlowName":" WP3_test_Final_AfterAdaptation_Name",
"endPointServices":[
        {
            "serviceId":"http://localhost:8080/demo-app-1.0/services/cardDesigner?wsdl",
            "serviceTaskId":"",
            "type":"WS",
            "ip":"127.0.0.1:8080"
        },
        {
            "serviceId":"http://localhost:8080/demo-app-1.0/services/email?wsdl",
            "serviceTaskId":"",
            "type":"WS",
            "ip":"127.0.0.1:8080"
        }
    ]
}

Note:

  • Change the ip attribute with the available Web Service definition (running WSDL description), if not the WorkflowEngine doesn’t allow to deploy the BPMN file.
  • The attributes workFlowId and workFlowName can be empty, in this case the name will be the same.
  • TenantId is not necessary since, we will use the same tenantId that the original deployment has.

Response codes:

*201    Indicates the adaptation for this instance was created.
*400    Indicates there was no content present in the request body or the content mime-type is not supported for deployment. The status-description contains additional information.

Success response body:

  • "activityId": it indicates the task where the instance is stopped (we are validating that the new process definition contains this sid),
  • "businessKey": (To be validated),
  • "completed": it indicates if the instance has completed,
  • "ended": it indicates if the instance has ended,
  • "id": id of the instance, of course it is the same that we have at the beginning (InstanceId in the URL call),
  • "processDefinitionId": New process definition with the new endpoints, id and name,
  • "processDefinitionUrl": url to obtain the process definition,
  • "suspended": if the instance is suspended,
  • "tenantId": the tenant id, we will maintain the original one,
  • "url": url to obtain the instance,
  • "variables": the variables associated to this instance.

Example of the response:

{
    "activityId": "sid-FD0DD857-8763-4E46-8ED4-530FFAF19B27",
    "businessKey": null,
    "completed": false,
    "ended": false,
    "id": "82501",
    "processDefinitionId": "WP3_test_Final_AfterAdaptation:1:85004",
    "processDefinitionUrl": "http://localhost:8080/activiti-webapp-rest2/service/repository/process-definitions/WP3_test_Final_AfterAdaptation:1:85004",
    "suspended": false,
    "tenantId": "",
    "url": "http://localhost:8080/activiti-webapp-rest2/service/runtime/process-instances/82501",
    "variables": []
}
0 Fitxers adjunts
59879 Visualitzacions
Mitjana (0 Vots)
Comentaris
Encara no hi ha cap comentari. Vull ser el primer.