Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of send and receive task in camunda BPMN

Tags:

camunda

I am using a send task to which the following Javadelegate class is attached.

public class SendTaskDelegate implements JavaDelegate {

  public void execute(DelegateExecution execution) throws Exception {

execution.getProcessEngineServices()
  .getRuntimeService()
  .createMessageCorrelation("someMessage")
  .processInstanceBusinessKey("someBusinessKey")
  .correlate();

  }

}

But I am getting this error::

An error happend while submitting the task form : Cannot submit task form c0e85bad-719f-11e5-94aa-d897baecf24a: Cannot correlate message someMessage: No process definition or execution matches the parameters

How can I debug it?

like image 499
pallavi Avatar asked Oct 13 '15 12:10

pallavi


1 Answers

The error message says, that your JavaDelegate code just gets excuted correctly. The process engine tries to find a running process instance with 'someBusinessKey' as business key and currently waiting for a message 'someMessage', but does not find such an instance. Your code acts as if there were such an instance and you try to find it and tell it about a message. See the docs section about correlation methods - in principle the mechanism is used to 'route' a message to the correct instance targeting it.

As a sidenote: your JavaDelegate seems to get called in the same transaction with which you also try to complete a task. The "borders of transactions" in your process can be managed with 'async' attributes described in the docs section about transactions in processes.

like image 77
Martin Schimak Avatar answered Dec 28 '22 15:12

Martin Schimak