4 Replies Latest reply on Mar 14, 2008 11:19 AM by tunstall

    JbossESB & jBPM: waiting for jBPM to end processinstance

    tunstall

      I'm using the newest GPD in Eclipse which has an extra "ESB Service" node, not just the usual "Node". I entered my ESB Service details (service, category, input/output variable mapping), haven't changed anything else (e.g. in the start/end node).

      I configured my ESB service following the bpm_orchestration1 quickstart example as follows:

      jboss-esb.xml file, services part:

      <services>
       <service category="BPM_Orchestration_Deploy_Service" name="Deploy_Service"
       description="BPM Orchestration Sample 1: Use this service to deploy a process instance">
       <listeners>
       <fs-listener name="Gateway" busidref="deployGwChannel" maxThreads="1" is-gateway="true" />
       <fs-listener name="ESB-Listener" busidref="deployEsbChannel" maxThreads="1" />
       </listeners>
       <actions>
       <action name="DeployFromFile" class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
       <property name="command" value="DeployProcessDefinition" />
       <property name="process-definition-file" value="/processdefinition.xml" />
       </action>
       </actions>
       </service>
      
      
       <service category="ESB" name="BCS_Starter_Service"
       description="BPM Orchestration Sample 1: Use this service to start a process instance">
       <listeners>
       <jms-listener name="BCS-Gateway" busidref="bcs_GwChannel" maxThreads="1" is-gateway="true" />
       <jms-listener name="BCS-Listener" busidref="bcs_EsbChannel" maxThreads="1" />
       </listeners>
       <actions>
       <action name="spy2" class="mypackage.MessageSpy" />
       <!-- move the body.getContents() into jBPM -->
       <action name="create_new_process_instance" class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
       <property name="command" value="NewProcessInstanceCommand" />
       <property name="process-definition-name" value="processDefinition2" />
       <property name="actor" value="FrankSinatra" />
       <property name="object-paths">
       <!-- esb-name maps to getBody().get("eVar1") -->
       <object-path esb="eVar1" bpm="counter" value="45" />
       <object-path esb="BODY_CONTENT" bpm="theBody" />
       </property>
       </action>
      
      
       <action name="signal_the_new_process_instance" class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
       <property name="command" value="SignalCommand" />
       <property name="process-definition-name" value="processDefinition2" />
       <property name="object-paths">
       <!-- esb-name maps to getBody().get("eVar1") -->
       <object-path esb="eVar1" bpm="counter" value="45" />
       <object-path esb="BODY_CONTENT" bpm="theBody" />
       </property>
       </action>
       </actions>
       </service>
       </services>


      processdefinition.xml
      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition xmlns="" name="processDefinition2">
       <start-state name="start">
       <transition to="esb_test"></transition>
       </start-state>
      
      
       <node name="esb_test">
       <action
       class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
       <esbCategoryName>ESB</esbCategoryName>
       <jbpmToEsbVars>
       <mapping jbpm="theBody" esb="BODY_CONTENT"></mapping>
       </jbpmToEsbVars>
       <returnVars>
       <mapping jbpm="theBody" esb="BODY_CONTENT"></mapping>
       </returnVars>
       <esbServiceName>BCS_MyTestService</esbServiceName>
       </action>
       <transition to="end1"></transition>
       </node>
      
      
       <end-state name="end1"></end-state>
      </process-definition>


      My problem here now is the following: basically I want an ESB service, which starts a BPM, waits until the BPM is finished, and uses the message processed by the BPM in the ESB return message. When using "normal" nodes (not ESB nodes) I can configure a timeout, but with that "ESB Service" node there is no timeout to wait. Right now the ESB service continues running right after the BPM was started, but before any data was returned. Did I forget to configure a necessary action or node-enter/-leave?

        • 1. Re: JbossESB & jBPM: waiting for jBPM to end processinstance
          kconner

          There is no guaranteed way to make the processing of jBPM synchronous in this manner, primarily because the process could involve an indeterminate number of asynchronous nodes and/or exist over a long lifetime.

          The way to achieve what you want would be to have your business process notify a second ESB service when the process terminates. You should be able to do this using a 'process-end' action but the action class will differ depending on your ESB version.

          In ESB 4.2.1GA you would continue to use the EsbActionHandler but without specifying the millisToWaitForResponse attribute, in the current trunk or the SOA Platform you would use the dedicated EsbNotifier class.

          • 2. Re: JbossESB & jBPM: waiting for jBPM to end processinstance
            tunstall

            Thanks.

            You said there is no guaranteed way, is there an "unguaranteed" way?


            The main problem with splitting my ESB service into 2 services (namely an "incoming service" for messages into my ESB, and an "outgoing reply service" for the reply of the BPM to my caller) would be, that I won't be able to allow any synchronous remote procedure calls, but that is exactly what I would want to do (e.g. stopping the action pipeline of my ESB service until the BPM is done). As I understand right now, the transfer from the ESB to the jBPM is simply a message.deliverAsync().

            If this info is helpful, I have a global timeout of roughly 10seconds for all the actions in my BPM, after that my webservice assumes that the databases etc. being queried are not reachable, and continues with default settings.

            • 3. Re: JbossESB & jBPM: waiting for jBPM to end processinstance
              kconner

               

              "tunstall" wrote:
              You said there is no guaranteed way, is there an "unguaranteed" way?


              If you are using ESB 4.2.1GA then the signal to start the process occurs in a synchronous manner and the process will execute up to the point that it has no more synchronous actions.

              If you are using the SOA Platform then this is now completely asynchronous.

              "tunstall" wrote:
              The main problem with splitting my ESB service into 2 services (namely an "incoming service" for messages into my ESB, and an "outgoing reply service" for the reply of the BPM to my caller) would be, that I won't be able to allow any synchronous remote procedure calls

              Actually, this is not true. It is easy to simulate a synchronous invocation of the service using asynchronous messaging.

              "tunstall" wrote:
              As I understand right now, the transfer from the ESB to the jBPM is simply a message.deliverAsync().

              Sorry, which part are you referring to?


              • 4. Re: JbossESB & jBPM: waiting for jBPM to end processinstance
                tunstall

                 

                "Kevin.Conner@jboss.com" wrote:
                "tunstall" wrote:
                You said there is no guaranteed way, is there an "unguaranteed" way?


                If you are using ESB 4.2.1GA then the signal to start the process occurs in a synchronous manner and the process will execute up to the point that it has no more synchronous actions.

                Right now we're using ESB 4.2GA, due to technical restrictions on the JMS version being used by our system and the ESB 4.2.1GA.

                By "process", are you referring to the BPM process, or the ESB action pipeline? Because right now I have only 1 node with a synchronous ESB action being called (I already saw in the GPD, that there is an option to set an ESB node to asynchronous).

                "Kevin.Conner@jboss.com" wrote:
                "tunstall" wrote:
                The main problem with splitting my ESB service into 2 services (namely an "incoming service" for messages into my ESB, and an "outgoing reply service" for the reply of the BPM to my caller) would be, that I won't be able to allow any synchronous remote procedure calls

                Actually, this is not true. It is easy to simulate a synchronous invocation of the service using asynchronous messaging.

                Of course. I already thought about sending the original ESB message as attachment, transfer it somehow into the BPM, and when handing the data from the BPM back to my "reply service" simply use the administrative data (from/to/timestamp etc.) from the attached ESB message.


                "Kevin.Conner@jboss.com" wrote:
                "tunstall" wrote:
                As I understand right now, the transfer from the ESB to the jBPM is simply a message.deliverAsync().

                Sorry, which part are you referring to?

                I basically meant when the BPM is being called from within the ESB action pipeline, the ESB continues processing its action pipeline instead of waiting for the BPM to end. That is, unless I am mistaken, simply an asynchronous call from the ESB to the BPM.