Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

415
Views
Receivetask in camunda is not working as expected

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

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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
about 4 years ago · Santiago Trujillo Report

0

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" />
about 4 years ago · Santiago Trujillo Report

0

Assuming your process looks something like this:

O -- ( M ) -- ( M ) -- O
     send    receive

This error means that a response was received "earlier" than the request was sent. And by sent, I mean the whole transaction of the send-request process.

So, in other words, because of the fast response, there is no commited transaction in Camunda Database for the send-request process. Thus, when camunda processes the response-received process, it is not possible to correlate the response-received with the send-request.

One suggested solution is to use Async Continuations that Camunda offers and you might check in their official website. More specifically, you might use Async Before at the send-request level:

( M ) 
 send   

Async Before will save the transaction in Camunda database, before the send-request process will begin. Τherefore, it will be possible for the response to be correlated.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!