5 Replies Latest reply on Nov 28, 2011 12:25 PM by while_true

    Invoking JBoss ESB BPM through Web Services

    while_true

      Hey guys!

       

      I'm developing an application that interacts with JBoss ESB through Web Services.

      The idea is to make available a web service that, when invoked, starts a jBPM flow through a ESB ServiceInvoker call.

       

      Everything went swell until I've noticed that in the JBoss log the ESB returns first than the BPM flow ends...

      Is this normal? Is the ESB BPM call assynchronous?

       

      In my idea the ServiceInvoker deliverSync(...) method should stay locked and only return after all the actions in the ESB service that is called have finished, and not after the BPM flow is triggered. Am I right?

       

      Please can you enlighten me?

       

      Thank you!

       

      Best regards

        • 1. Re: Invoking JBoss ESB BPM through Web Services
          mageshbk

          Could you share the action configuration which starts the jBPM flow?

          • 2. Re: Invoking JBoss ESB BPM through Web Services
            while_true

            Hey Magesh,

             

            Here it is:

             

            <service category="GetInfoServices"
               description="Get the info" name="GetInfo">
               <listeners>
                <jms-listener busidref="getInfoGwChannelBpm"
                 is-gateway="true" name="GetInfoGwChannelBpm"/>
                <jms-listener busidref="getInfoEsbChannelBpm" name="GetInfoEsbChannelBpm"/>
               </listeners>
               <actions mep="RequestResponse">
                <action
                 class="actions.CreateOrderAction"
                 name="createOrderAction" process="createOrder"/>
                <action class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"
                 name="getInfoBpmFlow" process="process">
                 <property name="command" value="StartProcessInstanceCommand"/>
                 <property name="process-definition-name" value="getInfo"/>
                 <property name="esbToBpmVars">
                  <mapping bpm="theBody" esb="BODY_CONTENT"/>
                 </property>
                </action>
                <action
                 class="actions.CloseOrderAction"
                 name="closeOrderAction" process="closeOrder"/>
               </actions>
              </service>
            
            
            • 3. Re: Invoking JBoss ESB BPM through Web Services
              mageshbk

              António,

               

              Invoking the service GetInfoServices:GetInfo using deliverySync will indeed return as soon as all the actions have been completed in that pipeline. Here one of your action is a BpmProcessor action that invokes a StartProcessInstanceCommand. This is a jBPM API command and will only initiate the process. It will not poll and wait for the process to complete. You will have to poll for process completion in a separate action to acheive what you need. Ideally the process could involve human tasks and can run for days/months. So you should take these into consideration when designing services.

              1 of 1 people found this helpful
              • 4. Re: Invoking JBoss ESB BPM through Web Services
                while_true

                Thank you, Magesh.

                 

                I'll try to use the separate action approach to check either if the jBPM process as ended or not and then I'll let you know how it went!

                 

                Best regards.

                • 5. Re: Invoking JBoss ESB BPM through Web Services
                  while_true

                  Magesh,

                   

                  I tried to add some kind of synchronization to my service but unfortunately I wasn't able to accomplish what I intended..

                  At the CloseOrderAction, a class that extends ESB's AbstractActionLifecycle class, I've added the following:

                   

                  public class CloseOrderAction extends AbstractActionLifecycle {
                  
                       public final Message closeOrder(final Message message) {
                            synchronized(message) {
                                 message.wait();
                            }
                  
                            ...
                       }
                  }
                  

                   

                  And at the last action of the jBPM process I've something like this:

                   

                  public class DummyProcess extends AbstractActionLifecycle {
                  
                       public final Message executeDummyAction(final Message message) {
                            ...
                  
                            synchronized(message) {
                                 message.notify();
                            }
                       }
                  }
                  

                   

                  Well the problem is that, using the ESB's process flow message as the synchronization token, the process stays blocked at the CloseOrderAction's closeOrder method...


                  What do you think is the better approach for the use of the synchronization token in the ESB's flow?