Engineering
Fluent API for Message Correlation
Camunda BPM 7.1.0-alpha4 features a new fluent API for message correlation. BPMN 2.0 defines events and tasks catching messages. The following is a fragment of a process waiting for an order to be cancelled: In BPMN 2.0 XML you have to provide a name for the message you want to catch: <bpmn2:definitions …> … <bpmn2:message id="<b>Message_1</b>" name="<b>orderCancelled</b>"/> … <bpmn2:process id="Process_1" isExecutable="false"> … <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_2" name="Order Cancelled"> <bpmn2:messageEventDefinition messageRef="<b>Message_1</b>"/> </bpmn2:intermediateCatchEvent> </bpmn2:process> New Fluent API Camunda Engine now features a fluent DSL for correlating this message to the process engine: runtimeService.createMessageCorrelation("<b>orderCancelled</b>") .processInstanceBusinessKey("someOrderId") .setVariable("CANCEL_REASON", "someReason") …
By Daniel Meyer
