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

    How to deliver a synchronous message when integrating jbpm

    ztk5912

      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.

      <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?

        • 1. Re: How to deliver a synchronous message when integrating jb
          camunda

          I am not sure if the problem is still bothering you?

          I would argue that you shouldn't design for a synchronous answer, even if you could somehow tweak it technically.

          Basically the synchronous Invoker is not more than a CallBack-JMS-Queue (in the case you use JMs as a transport). By using a CallBack-Queue, you can also call the client back at the end of all processing.

          You just should think about the possibility, that no answer arrives in the timeout (which can also happen with the synchronous invoker)... What do you think?

          Or what was you solution to this?

          Cheers
          Bernd

          • 2. Re: How to deliver a synchronous message when integrating jb
            kconner

            First of all, this is a user forum question so should be there. I will move it shortly.

            What you are trying to do is supported in the current trunk, there is a similar discussion already happening on the forums about this.

            Bernd is also right though, in that it is better to use a continuation type of mechanism. All the ESB/jBPM interactions involve one way messages.

            There is an example of a continuation setup on the wiki but, unfortunately, this appears to be running very slow at the moment.

            There is a pdf of the page at http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/docs/wiki/AsyncContinuation.pdf but, obviously, without the source code.