Show Table of Contents
7.19. Passing Parameters to a jBPM5 Process on signalEvent
// create the ESB message
Message esbMessage = MessageFactory.getInstance().getMessage();
// set the process event type as defined in the process definition
esbMessage.getProperties().setProperty("processEventType", "NewMessage");
// add a parameter
esbMessage.getProperties().setProperty("name", "Hardy");
// setup data required to identify the intended target process instance
ContextImpl ctxi = (ContextImpl) esbMessage.getContext();
// set the session id
ctxi.setContext("jbpm5-session-id", sessionId);
// set the instance id.
ctxi.setContext("jbpm5-processinstance-id", processInstanceId);
The following 'name' property will be assigned on process start when the 'name' ESB message property will be set:
<definition ...>
<itemDefinition id="_nameItem" structureRef="String" />
<process name="Hello" tns:packageName="defaultPackage" ...>
<property id="name" itemSubjectRef="_nameItem"/>
<!-- ... -->
</process>
<!-- ... -->
</definition>
To define a process property of type java.util.Map:
<definition ...>
<itemDefinition id="_objectMapItem" structureRef="java.util.Map" />
<process name="Hello" tns:packageName="defaultPackage" ...>
<property id="objectMap" itemSubjectRef="_objectMapItem"/>
<!-- ... -->
</process>
<!-- ... -->
</definition>
To extract parameters:
String name2 = objectMap.get("name"); // will retrieve the Hardy string

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.