How to deliver a synchronous message when integrating jbpm
ztk5912 Aug 8, 2008 3:54 AMI 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.
<services> <service category="Starter" name="StartProcess" description="to start a process instance"> <listeners> <jms-listener name="JMS-Gateway" busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" /> <jms-listener name="EsbListener" busidref="quickstartEsbChannel" maxThreads="1" /> </listeners> <actions mep="OneWay"> <action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore" /> <action name="display" class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction" process="displayMessage" /> <action name="start_process" class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"> <property name="command" value="StartProcessInstanceCommand" /> <property name="process-definition-name" value="LoopCheckPassword" /> <property name="esbToBpmVars"> <mapping esb="BODY_CONTENT" bpm="theBody" /> </property> </action> </actions> </service> <service category="SingleAction" name="CheckPassword" description="to check password using soapclient to communicate with web service"> <listeners> <jms-listener name="EsbListener1" busidref="useless1" maxThreads="1" /> </listeners> <actions> <action name="request-mapper" class="org.jboss.soa.esb.samples.quickstart.helloworld.CheckPassword.EsbAction.InputAdapter"> </action> <action name="soapui-client-action" class="org.jboss.soa.esb.actions.soap.SOAPClient"> <property name="wsdl" value="http://211.87.226.149/axis2/services/Hrser?wsdl" /> <property name="responseAsOgnlMap" value="true" /> <property name="SOAPAction" value="doCheckPassword" /> </action> </actions> </service> <service category="ResultService" name="returnResult" description="to deal with the return message from the process"> <listeners> <jms-listener name="EsbListener2" busidref="useless2" maxThreads="1" /> </listeners> <actions> <action name="resultExtraction" class="org.jboss.soa.esb.samples.quickstart.helloworld.CheckPassword.EsbAction.ShowAndReturnMessage"> </action> </actions> </service> </services>
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?