jBPM - jBoss ESB integration
andy00 Jan 11, 2013 4:50 AMHi, 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"> <esbServiceName> TestProcess </esbServiceName> <esbCategoryName> EntityServices </esbCategoryName> <bpmToEsbVars> <mapping bpm="praticaTest" esb="praticaTest"></mapping> </bpmToEsbVars> <esbToBpmVars> <mapping bpm="ESBexception" esb="ESBexception"></mapping> </esbToBpmVars> </action> <transition to="Service call ok?"></transition> </node> <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> </decision>
This is from jboss-esb.xml
<service category="EntityServices" description="TestProcess JBPM service" name="TestProcess"> <listeners> <jms-listener busidref="testProcess_esb_channel" name="testProcessJMSListener"/> </listeners> <actions mep="RequestResponse"> <!-- log message in --> <action class="com.utils.esb.EsbLogger" name="EchoSoapMessage1"> <property name="message" value="Start ESB - TestProcess -"/> </action> <action class="com.esb.testProcess.handler.TestProcessHandler" name="TestProcessHandler"> <property name="esbToBpmVars"> <mapping bpm="ESBexception" esb="ESBexception"/> </property> </action> <!-- log message out --> <action class="com.utils.esb.EsbLogger" name="EchoSoapMessage2"> <property name="message" value="End ESB - TestProcess -"/> </action> </actions> </service>
This is the handler defined above, TestProcessHandler:
@Process 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"); e.printStackTrace(); 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?