pallavi
pallavi

Reputation: 95

Usage of send and receive task in camunda BPMN

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?

Upvotes: 5

Views: 2811

Answers (1)

Martin Schimak
Martin Schimak

Reputation: 1373

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.

Upvotes: 6

Related Questions