During message correlation with `resultEnabled`, wrong entity is populated when "resultType": "Execution"
yanavasileva opened this issue · comments
Environment (Required on creation)
REST API 7.21.0+
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)
Perform message correlation with resultEnabled
and expected resultType: Execution
The resultType
isn't considered, always the processInstance
entity is returned.
Steps to reproduce (Required on creation)
Get the example from here: https://jira.camunda.com/browse/SUPPORT-21725?focusedCommentId=347192&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-347192
- start the application:
mvn spring-boot:run
- send request for message correlation to start process instance (expected return type: process defintion)
curl --location 'http://localhost:8080/engine-rest/message' \
--header 'Content-Type: application/json' \
--data '{
"messageName": "startPM",
"resultEnabled": true
}'
- send another request for message correlation
curl --location 'http://localhost:8080/engine-rest/message' \
--header 'Content-Type: application/json' \
--data '{
"messageName": "startESP",
"resultEnabled": true
}'
Observed Behavior (Required on creation)
The response contains resultType: Execution
and execution: null
.
[
{
"resultType": "Execution",
"execution": null,
"processInstance": {
"links": [],
"id": "aa79036a-06d6-11ef-a3f3-00ff18b69f72",
"definitionId": "81d0b026-06d6-11ef-a3f3-00ff18b69f72",
"businessKey": null,
"caseInstanceId": null,
"ended": false,
"suspended": false,
"tenantId": null
}
}
]
Expected behavior (Required on creation)
The response contains resultType: Execution
and the execution dto is populated.
[
{
"resultType": "Execution",
"execution": {
"id": "99e27609-06d9-11ef-a41a-00ff18b69f72",
"processInstanceId": "99e27609-06d9-11ef-a41a-00ff18b69f72",
"ended": false,
"tenantId": null
},
"processInstance": null
}
]
(created with 7.20)
Root Cause (Required on prioritization)
Since 7.21.0 the process instance is populated in the result all the time so it can be used in the user operation logs.
The REST API, doesn't consider the returnType
but checks if the process instance is present:
https://github.com/camunda/camunda-bpm-platform/blob/master/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/message/MessageCorrelationResultDto.java#L41-L44
(even thought the execution is also present)
Solution Ideas
- In the REST API, populate the process instance/execution dto after considering the
resultType
.
Hints
Links
- created on behalf of https://jira.camunda.com/browse/SUPPORT-21725
- caused by a6793fd
Breakdown
Dev2QA handover
- Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment
Review only of the backport is required. //cc @joaquinfelici