Return 通过 rest-engine 启动时来自 Camunda 进程的数据

Return data from Camunda process when started through rest-engine

我有一个名为 partnerPortal 的 Camunda 流程。这接受 3 个变量,

{
  "variables": {
    "userId" : {
      "value" : "user1"
  },
    "userName" : {
      "value" : "childProtect"
  },
    "accountType" : {
      "value" : "ideamart"
    }
  }
}

我使用带有端点 "engine-rest/process-definition/key/{processId}/start" 的 Camunda rest-engine 调用此过程使用单独的 spring-boot 应用程序。我的要求是,当进程完成时,我想从 Camunda 引擎 return 数据到外部 spring-boot 应用程序(就像常规 API 调用一样)。

例如,如果我使用 "engine-rest/process-definition/key/partnerPortal/start" 启动流程,我想从 Camunda 接收一个 JSON 数组引擎到 spring-boot 应用程序。

https://docs.camunda.org/manual/7.16/reference/rest/process-definition/post-start-process-instance/

请求正文:

  • withVariablesInReturn
    指示是否应返回流程实例在执行期间使用的变量。默认值:假

请求

POST /process-definition/aProcessDefinitionId/start

POST /process-definition/key/aProcessDefinitionKey/start

请求正文:

{
  "variables": {
    "someDate": {
      "value": "2021-09-08T00:00:00.0+0000",
      "type": "date"
    }
  },
   "withVariablesInReturn": true
}

回应

{
    "links": [
        {
            "method": "GET",
            "href": "http://localhost:8080/engine-rest/process-instance/d1d09e6b-99d0-11ec-b2a5-00ff01996606",
            "rel": "self"
        }
    ],
    "id": "d1d09e6b-99d0-11ec-b2a5-00ff01996606",
    "definitionId": "tcb-process:2:902391b6-99d0-11ec-b2a5-00ff01996606",
    "businessKey": null,
    "caseInstanceId": null,
    "ended": true,
    "suspended": false,
    "tenantId": null,
    "variables": {
        "result": {
            "type": "String",
            "value": "abc",
            "valueInfo": {}
        },
        "someDate": {
            "type": "Date",
            "value": "2021-09-08T08:00:00.000+0800",
            "valueInfo": {}
        }
    }
}