在Camunda中,如何区分在ErrorEnd事件终止的进程实例与EndEvent



我是Camunda的新手,我想了解如果进程实例在ErrorEndEvent终止,我如何捕获/获取错误信息。对于ErrorEndEvent和EndEvent,状态都标记为"已完成"。至少,我该如何区分两者呢?

REST API: engine-rest/history/process-instance
{
"id": "72392151-8517-11ea-9313-0242ac110002",
"businessKey": null,
"processDefinitionId": "TestError:5:6ac37e20-8517-11ea-9313-0242ac110002",
"processDefinitionKey": "TestError",
"processDefinitionName": null,
"processDefinitionVersion": 5,
"startTime": "2020-04-23T04:03:53.532+0000",
"endTime": "2020-04-23T04:03:54.669+0000",
"removalTime": null,
"durationInMillis": 1137,
"startUserId": null,
"startActivityId": "StartEvent_1",
"deleteReason": null,
"rootProcessInstanceId": "72392151-8517-11ea-9313-0242ac110002",
"superProcessInstanceId": null,
"superCaseInstanceId": null,
"caseInstanceId": null,
"tenantId": null,
"state": "COMPLETED"
}

获取流程实例活动的历史记录:

{{rest_url}}/history/activity-instance?processInstanceId=4008cd81-8622-11ea-b8c7-9c899b574756&sortOrder=desc&sortBy=startTime

另请参阅:https://docs.camunda.org/manual/latest/reference/rest/history/activity-instance/get-activity-instance-query/

示例结果:

[
{
"id": "Event_13nxum6:eac48940-8622-11ea-b8c7-9c899b574756",
"parentActivityInstanceId": "4008cd81-8622-11ea-b8c7-9c899b574756",
"activityId": "Event_13nxum6",
"activityName": null,
"activityType": "noneEndEvent",
"processDefinitionKey": "OrderProcessProcess",
"processDefinitionId": "OrderProcessProcess:1:27646e94-6998-11ea-9c0d-9c899b574756",
"processInstanceId": "4008cd81-8622-11ea-b8c7-9c899b574756",
"executionId": "4008cd81-8622-11ea-b8c7-9c899b574756",
"taskId": null,
"calledProcessInstanceId": null,
"calledCaseInstanceId": null,
"assignee": null,
"startTime": "2020-04-24T19:58:31.398+0800",
"endTime": "2020-04-24T19:58:31.398+0800",
"durationInMillis": 0,
"canceled": false,
"completeScope": true,
"tenantId": null,
"removalTime": null,
"rootProcessInstanceId": "4008cd81-8622-11ea-b8c7-9c899b574756"
},
{
"id": "PrepareOrderTask:78b10b79-8622-11ea-b8c7-9c899b574756",
"parentActivityInstanceId": "4008cd81-8622-11ea-b8c7-9c899b574756",
"activityId": "PrepareOrderTask",
...

您可以使用

POST/发动机休息/历史记录/活动实例

内容类型:application/json,带有以下请求体

{
"processDefinitionKey": "ProcessID",
"activityType": "errorEndEvent",
"finished":"true",
"sorting":
[{"sortBy": "endTime",
"sortOrder": "asc"
}]
}

参考https://docs.camunda.org/manual/latest/reference/rest/history/activity-instance/post-activity-instance-query/了解更多详细信息。

最新更新