Elvis Whizzkid
Elvis Whizzkid

Reputation: 41

How to use Camunda BPMN Send task and Receive Task

I am newbee in Camunda BPMN 2.0, i need help on how to implements and use send and receive task from one pool to another.

Upvotes: 3

Views: 13960

Answers (1)

meyerdan
meyerdan

Reputation: 549

Attach a JavaDelegate implementation to the send task:

<sendTask id="sendTask" camunda:class="org.camunda.bpm.MySendTaskDelegate" />

Inside the MySendTaskDelegate, correlate a message to the receive task in the other process instance:

public class MySendTaskDelegate implements JavaDelegate {

  public void execute(DelegateExecution execution) throws Exception {

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

  }

}

This assumes, that

  1. The waiting process instance has a businessKey of value someBusinessKey. The business key can be provided when starting the process instance.
  2. The waiting process instance has a receive Task with a message name someMessage. The message name for a receive task can be specified in BPMN 2.0 xml using the <message ... /> element. See: http://docs.camunda.org/latest/api-references/bpmn20/#tasks-receive-task

Upvotes: 7

Related Questions