Advertise with us

Our eBooks

JBPM5 Setting process variables at startup

You can provide input parameters to your process much the same way you did with jBPM3.

For example, here's how to set the initial value for the "money" process variable:

KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession =

Map<String, Object> inputParams =

         new HashMap<String, Object>();
inputParams.put("money", new Long(15));
// start a new process instance
ProcessInstance process =


Rememer that process variables need to be defined into your BPMN 2.0 process file. In this example:

<itemDefinition id="_moneyItem" structureRef="Integer" />

  <process processType="Private" isExecutable="true" id="com.sample.bpmn.task" name="Sample Task" >

    <!-- process variables -->
    <property id="money" itemSubjectRef="_moneyItem"/>

    . . . . .


Hint: if you are using Eclipse jBPM plugin, then you can define a variable by simply pointing to any place on your BPMN 2.0 diagram (where there are no nodes) and in the "Properties" Tab insert your variable:

jbpm5 process variables

© 2021 All Rights Reserved.

Please publish modules in offcanvas position.