2 Replies Latest reply on Oct 14, 2008 11:12 AM by Kevin Conner

    How to deliver a synchronous message when integrating jbpm

    Tracy Mcgrady Newbie

      I write a simple application,but I meet a problem.Here is the description of my application.
      In the esb I defined three services.Firt service is to start a jbpm process defined in the project using bpmprocessor.Second service is to check password,and it is to be called by the process using EsbActionHandler.Then the last service is to receive the final result return from the process and show the result.The following is part of my jboss-esb.xml.

       <service category="Starter" name="StartProcess"
       description="to start a process instance">
       <jms-listener name="JMS-Gateway"
       busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" />
       <jms-listener name="EsbListener"
       busidref="quickstartEsbChannel" maxThreads="1" />
       <actions mep="OneWay">
       <action name="testStore"
       class="org.jboss.soa.esb.actions.TestMessageStore" />
       <action name="display"
       process="displayMessage" />
       <action name="start_process"
       <property name="command"
       value="StartProcessInstanceCommand" />
       <property name="process-definition-name"
       value="LoopCheckPassword" />
       <property name="esbToBpmVars">
       <mapping esb="BODY_CONTENT" bpm="theBody" />
       <service category="SingleAction" name="CheckPassword"
       description="to check password using soapclient to communicate with web service">
       <jms-listener name="EsbListener1" busidref="useless1"
       maxThreads="1" />
       <action name="request-mapper"
       <action name="soapui-client-action"
       <property name="wsdl"
       value="" />
       <property name="responseAsOgnlMap" value="true" />
       <property name="SOAPAction" value="doCheckPassword" />
       <service category="ResultService" name="returnResult"
       description="to deal with the return message from the process">
       <jms-listener name="EsbListener2" busidref="useless2"
       maxThreads="1" />
       <action name="resultExtraction"

      Then in the client class,I use ServiceInvoker to deliver a synchronous messge.The code is:

      ServiceInvoker deliveryAdapter = new ServiceInvoker("Starter", "StartProcess");
      response=deliveryAdapter.deliverSync(message, 10000L);

      Now the problem is,the result return to the third service which is form the process cannot be passed to the client. The purpose of my application is to check multi-group username and password one time with the help of jbpm while the second service just can do a single check. So I want to return the final result to the client.But in my application the client is to call the first service and receive the message processed by the actions in the first service.I cannot receive the final result because the action of calling process(using BpmProcessor) in the first service is asynchronous. How can I manage it?