通过rest-engine启动时从Camunda进程返回数据

发布于 2025-01-10 17:12:32 字数 612 浏览 0 评论 0原文

我有一个名为 PartnerPortal 的 Camunda 进程。它接受 3 个变量,因为

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

我使用 Camunda Rest-engine 和端点 “engine-rest/process-definition/key/{processId}/start” 调用此流程一个单独的 spring-boot 应用程序。我的要求是,我想在进程完成时将数据从 Camunda 引擎返回到外部 spring-boot 应用程序(就像常规 API 调用一样)。

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

I have a Camunda process called partnerPortal. This accepts 3 variables as,

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

I call this process using Camunda rest-engine with the endpoint "engine-rest/process-definition/key/{processId}/start" using a separate spring-boot application. My requirement is, I want to return data from the Camunda-engine to the external spring-boot application when the process completes (Just like a regular API call).

For example, if I start the process using "engine-rest/process-definition/key/partnerPortal/start", I want to receive a JSON array from the Camunda engine to the spring-boot application.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

望喜 2025-01-17 17:12:32

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

请求正文:

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

请求

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": {}
        }
    }
}

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

Request Body:

  • withVariablesInReturn
    Indicates if the variables, which was used by the process instance during execution, should be returned. Default value: false

Request

POST /process-definition/aProcessDefinitionId/start

POST /process-definition/key/aProcessDefinitionKey/start

Request body:

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

Response

{
    "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": {}
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文