0 Replies Latest reply on Jan 11, 2013 4:50 AM by Andy Peer

    jBPM - jBoss ESB integration

    Andy Peer Newbie

      Hi, I have a process which calls an esb service and I pass to this service some variables.

      What I can't do, is to send back a variable to jbpm.


      This is a snippet from processdefinition.xml

      <node name="ESB State 2">
              <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
                      <mapping bpm="praticaTest" esb="praticaTest"></mapping>
                      <mapping bpm="ESBexception" esb="ESBexception"></mapping>
              <transition to="Service call ok?"></transition>
      <decision name="Service call ok?" expression="#{(ESBexception eq 'ESBexception' ? 'to Exception State' : 'to END')}">
              <transition to="Exception State" name="to Exception State"></transition>
              <transition to="END Test" name="to END"></transition>



      This is from jboss-esb.xml

      <service category="EntityServices"
         description="TestProcess JBPM service" name="TestProcess">
          <jms-listener busidref="testProcess_esb_channel" name="testProcessJMSListener"/>
         <actions mep="RequestResponse">
          <!-- log message in -->
          <action class="com.utils.esb.EsbLogger" name="EchoSoapMessage1">
           <property name="message" value="Start ESB - TestProcess -"/>
           class="com.esb.testProcess.handler.TestProcessHandler" name="TestProcessHandler">
           <property name="esbToBpmVars">
            <mapping bpm="ESBexception" esb="ESBexception"/>
          <!-- log message out -->
          <action class="com.utils.esb.EsbLogger" name="EchoSoapMessage2">
           <property name="message" value="End ESB - TestProcess -"/>



      This is the handler defined above, TestProcessHandler:

          public Message process(Message message) throws Exception {
              Body body = message.getBody();
              ListString listValues = (ListString)body.get("praticaTest");
              message.getBody().add("ESBexception", "");
              try {
                  logger.info("ESB TestProcessHandler - BEGIN");
                  if (listValues.getString().get(0).equalsIgnoreCase("103")) {
                      throw new Exception("******  Code generated exception  ***********");
                  // Other code.....
              catch (Exception e) {
                  logger.info("ESB TestProcessHandler - EXCEPTION");
                  message.getBody().add("ESBexception", "ESBexception");
                  throw e;
              finally {
                  logger.info("ESB TestProcessHandler - END");
              return message;



      I can get the object praticaTest (jbpm -> esb) correctly, but in jbpm, the ESBexception value (in the decision node) is always null.

      The ESBexception variable is set as a process variable when I first create a process instace.


      What am I missing?