Red Hat Training
A Red Hat training course is available for JBoss Enterprise SOA Platform
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