Overview:
=========
  The purpose of the bpm_orchestration3 quickstart sample is to demonstrate the
  use jBPM to perform async calls into ESB services. This is a fairly advanced example.
  Make sure you are very comfortable with the bpm_orchestration1 and 2 before attempting 
  this one.  The provided process definition had a start, end and then three main nodes
  that include Service1, 2 and 3 asynchronously. After each invocation it goes into a wait-state.
  The process must then receive a signal.

To Run standalone mode:
=======================
  Do not run standalone.

To Run '.esb' archive mode:
===========================
  1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
  2. type 'ant deployProcess'
  3. Switch back to Application/ESB Server console and wait for the message
     'Process Definition Deployed:' to appear on the console.
  3. In Window1, type 'ant startProcess -Dtoken=Demo1'
     Switch back to Application/ESB Server console and look for
     [STDOUT] ** Begin Service 1 **
     [STDOUT] In : Hello start
     [STDOUT] Out: Hello start 'Service 1' 
     [STDOUT] ** End Service 1 **

  4. Enter the jBPM console (http://localhost:8080/jbpm-console/sa/processes.jsf), and
     login.   Once logged in, examine each process that you see using the "Examine" link 
     and find the "Instance ID" for the process that has a Key of "Demo1". 
  5. In Window1, if the Instance ID you found in Step 4 was 1, 
     type 'ant -Dtoken=1 signalProcess'
     Substitute whatever number you found for an instance id in the environment variable 
     part of that statement (-Dtoken=[Instance ID]).
     Switch back to Application/ESB Server console and look for:
     [SetupSignal] --------------------------------
     [SetupSignal] jbpmTokenId: 1
     [SetupSignal] Body: Hello Signal
     [SetupSignal] --------------------------------
     [STDOUT] ** Begin Service 2 **
     [STDOUT] In: Hello Signal
     [STDOUT] Out: Hello Signal 'Service 2' 
     [STDOUT] ** End Service 2 **
     [STDOUT] ** Begin Service 3 **
     [STDOUT] In: Hello Signal 'Service 2' 
     [STDOUT] Out: Hello Signal 'Service 2'  'Service 3' 
     [STDOUT] ** End Service 3 **
     [SetupSignal] --------------------------------
     [SetupSignal] jbpmTokenId: 1
     [SetupSignal] Body: Hello Signal
     [SetupSignal] --------------------------------

     Note: The STDOUT messages are from the 3 groovy scripts representing the logic of
     each service.

  6. To undeploy the esb archive, type 'ant undeploy' ("Window1").

Things to Consider:
===================
   - Review the process definition, specifically one of the nodes like Service 1:
   	<node name="Service 1">
		<action name="esbAction"
			class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
			<esbCategoryName>
				BPM_Orchestration3_Service1
			</esbCategoryName>
			<esbServiceName>Service1</esbServiceName>
			<bpmToEsbVars>
				<mapping jbpm="theBody" esb="BODY_CONTENT" />
			</bpmToEsbVars>
			<returnVars>
				<mapping jbpm="theBody" esb="BODY_CONTENT" />
			</returnVars>
		</action>
		<transition to="Service 2"></transition>
	</node>
	
	Note: There is NO <millisToWaitForResponse>5000</millisToWaitForResponse>
	therefore is no waiting for a response from the ESB.  The request is
	made asynchronously to the ESB Service and the process instance enters a wait-state.
	It goes to sleep and waits some external "signal".  A waiting/sleeping
	process instance is held in the database.
	 
	The secret to being able to wake up a sleeping process instance is the tokenid.
	
	This example uses two custom actions to prepare the content needed to properly
	interact with the jBPM business process. SetupKey.java and SetupSignal.java are
	used to peel the businessKey and/or the token id out of the JMS message and place
	it in the proper location for 
	org.jboss.soa.esb.services.jbpm.actions.BpmProcessor
	
	This command line arguments -Dtoken=12
	are passed into the Ant build.xml, then passed into the SendJMSMessage.java as command
	line arguments and then SendJMSMessage.java adds the value from the command line on
	to the JMS message before sending into the appropriate queue.
	
	Tip: If you use the jbpm-console (http://localhost:8080) and the Graphical Process
	Designer provided by Red Hat Developer Studio then you can visually "see" the process
	moving from step to step to step with each command line signal.	
	
	
	