We have been using camunda 7.4 version in most of our projects along with camunda-bpm-spring-boot-starter 1.1.0.
We have a project where in the camunda flow we try to publish a message to a message broker which internally is consumed by another system and re-publish a new message to the same message broker. Then we trigger a receiveTask to receive that message and process further. To listen to the incoming message we use org.springframework.amqp.core.MessageListener and we define the message co-relation for receiveTask within the onMessage() method. But we get below error in doing so
org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message 'ReceiveAmsharedResponse': No process definition or execution matches the parameters
We are trying to figure where the problem is? Is it in the version of camunda we are using or the problem is with the usage of receiveTask. We tried all approaches defined in https://docs.camunda.org/manual/7.4/reference/bpmn20/tasks/receive-task/ but no luck.
For the method createMessageCorrelation we get above error. And for other methods we get a NPE as EventSubscription/Execution objects are null.
Sample Camunda flow receiveTask Usage is as below:
<bpmn2:receiveTask id="ReceiveTask" name="Receive Task" messageRef="Message_06nl07f">
<bpmn2:incoming>SequenceFlow_xyz</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_190m9nx</bpmn2:outgoing>
</bpmn2:receiveTask>
......
......
<bpmn2:message id="Message_06nl07f" name="Message" />
And sample message co-relation code:
class XYZ implements MessageListener {
onMessage() {
runtimeService.createMessageCorrelation("Message")
.processInstanceBusinessKey(resourceId)
.setVariable(ACTIVITY_RESULT, activityResult)
.correlate();
}
Any help would be appreciated?
Thanks, Viswanath
A collapsed pool is used to represent a system which supports the process and/or carries out process tasks on its own. The pool could be expanded later to model the internal system details, maybe even with the goal to execute a technical process flow directly with a BPMN capable process engine.
A send task is used to model the publication of a message to an external system; for example, to a Kafka topic or a mail server. Send tasks behave exactly like service tasks. Both task types are based on jobs and job workers.
To BPMN, the pool represents a higher-ranking instance compared to its lanes. The pool assumes process control – in other words, it assigns the tasks. It behaves like the conductor of an orchestra, and so this type of process is called “orchestration.”
Camunda's Workflow Engine executes processes that are defined in Business Process Model and Notation (BPMN), the global standard for process modeling. With BPMN, you can automate your most complex business processes using an easy-to-adopt visual modeling language.
Assuming your process looks something like this:
O -- ( M ) -- ( M ) -- O
send receive
If the response message is send very fast, it possible that the onMessage
and message correlation is executed before the message event subscription is persisted in the database. Basically the message arrives while the send task is stil being executed.
One way to avoid this would be to create the message subscription in parallel with sending the event:
O -- + -- ( M ) -- + -- O
| send |
`----( M ) --´
receive
Regarding to the given exception message which is :
org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message 'ReceiveAmsharedResponse': No process definition or execution matches the parameters
I assume that you correlate a message with the name ReceiveAmsharedResponse
, but you defined a Message with a different name for your ReceiveTask.
Changing the definition of your Message to the following should work:
<bpmn2:message id="Message_06nl07f" name="ReceiveAmsharedResponse" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With