1 Reply Latest reply on Jun 2, 2011 4:16 AM by nishant_hadole

    EsbActionHandler – esbToBpmVars behaviour

    nishant_hadole

      In simple JBPM to ESB integration, I just wanted to add an ESB node with EsbActionHandler action. The purpose is to just process some variable from business process in ESB and return the output. However, it’s not working as expected. The variable I set from jBPM to ESB transmits well but reverse is not working. When checked through source of EsbActionHandler action, it seems that the attribute esbToBpmVars is neglected at all, in createReplyTo() method. As the call from jBPM to ESB is Async, how am I supposed to get the updated value back in jBPM.

       

      The versions are JBoss ESB - 4.9_SOA_5.1 & jBPM-3.2.5.SP5.

       

      jBPM Process Definition File

       

      <?xml version="1.0" encoding="UTF-8"?>

      <process-definition xmlns="urn:jbpm.org:jpdl-3.2"
      name="test">
      <start-state name="start">
        <transition to="esb1"></transition>
        <event type="node-leave">
         <script>
          executionContext.getContextInstance().setVariable(&quot;input&quot;, &quot;Hello World&quot;);
         </script>
        </event>
      </start-state>

      <node name="esb1">
        <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
         <esbServiceName>
          SimpleListener
         </esbServiceName>
         <esbCategoryName>
          FirstServiceESB
         </esbCategoryName>
         <bpmToEsbVars>
          <mapping bpm="input" esb="BODY_CONTENT"></mapping>
         </bpmToEsbVars>
         <esbToBpmVars>
          <mapping bpm="result" esb="BODY_CONTENT"></mapping>
         </esbToBpmVars>
        </action>
        <event type="node-leave">
         <script>
          System.out.println(&quot;Result Value &quot;+executionContext.getContextInstance().getVariable(&quot;result&quot;));
         </script>
        </event>
        <transition to="end"></transition>
      </node>

      <end-state name="end"></end-state>
      </process-definition>

       

      ESB Service

       

      <?xml version="1.0"?>

      <jbossesb parameterReloadSecs="5"

      xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">

      <providers>

        <jms-provider connection-factory="ConnectionFactory" name="JBossMQ">

         <jms-bus busid="quickstartGwChannel">

          <jms-message-filter

           dest-name="queue/quickstart_helloworld_Request_gw" dest-type="QUEUE"/>

         </jms-bus>

         <jms-bus busid="quickstartEsbChannel">

          <jms-message-filter

           dest-name="queue/quickstart_helloworld_Request_esb" dest-type="QUEUE"/>

         </jms-bus>

        </jms-provider>

      </providers>

      <services>

        <service category="FirstServiceESB" description="Hello World" name="SimpleListener">

         <listeners>

          <jms-listener busidref="quickstartGwChannel" is-gateway="true" name="JMS-Gateway"/>

          <jms-listener busidref="quickstartEsbChannel" name="helloWorld"/>

         </listeners>

         <actions mep="OneWay">

          <action

           class="org.jboss.soa.esb.samples.quickstart.helloworld.MyListenerAction"

           name="HelloWorldAction" process="displayMessage"/>

         </actions>

        </service>

      </services>

      </jbossesb>

       

      ESB Action Class

       

      public class MyListenerAction extends AbstractActionLifecycle
      {

      protected ConfigTree _config;

      public MyListenerAction(ConfigTree config)
      {
        _config = config;
      }

      public Message displayMessage(Message message) throws Exception
      {
        String input = (String) message.getBody().get();
        String messageOutput = input + " Nishant!!!"; 
        System.out.println("output should be " + messageOutput);
        message.getBody().add(messageOutput);
        return message;

      }
      }