Red Hat Training

A Red Hat training course is available for JBoss Enterprise SOA Platform

9.4. Instantiating a Deployment

  1. Create a new process instance once the process definition is deployed. (Note that you can use the StartProcessInstanceCommand. This command allows you to create a process instance with some pre-set initial values.)
    <service category="BPM_orchestration4_Starter_Service"
    name="Starter_Service"
    description="BPM Orchestration Sample 4: Use this service to start a
    process instance">
    	<listeners>
    	</listeners>
    		<actions>
    			<action name="setup_key" class=
    				"org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
    					<property name="script"
    						value="/scripts/setup_key.groovy" />
    		</action>
    		<action name="start_a_new_order_process" class=
    			"org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
    				<property name="command"
    					value="StartProcessInstanceCommand" />
    				<property name="process-definition-name"
    					value="bpm4_ESBOrderProcess" />
    				<property name="key" value="body.businessKey" />
    				<property name="esbToBpmVars">
    					<mapping esb="BODY_CONTENT" bpm="entireOrderAsXML" />
    			</property>
    		</action>
    	</actions>
    </service>
    
  2. The new process instance is now invoked and using a script. The jBPM key is set to the value of the OrderId by an incoming order XML file.
    This same XML is subsequently put into a jBPM context, through use of the esbToBpmVars mapping.
    In the bpm_orchestration4 quick start, the XML came from the Seam DVD Store and the SampleOrder.xml looks like this:
    <Order orderId="2" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0"
    	netAmount="59.97" totalAmount="64.92" tax="4.95">
    		<Customer userName="user1" firstName="Rex" lastName="Myers" state="SD"/>
    			<OrderLines>
    				<OrderLine position="1" quantity="1">
    					<Product productId="364" title="Gandhi"
    						price="29.98"/>
    				</OrderLine>
    				<OrderLine position="2" quantity="1">
    						<Product productId="299" title="Lost Horizon" price="29.99"/>
    				</OrderLine>
    			</OrderLines>
    </Order>
    

    Note

    Enterprise Service Bus and JBoss Business Process Manager deployments are what is known as "hot."
    The jBPM has a special feature that results in process deployments being "versioned". Newly created process instances will use the latest version, while existing ones will run to their conclusion using the process deployment they were started on.