3 Replies Latest reply on Jan 11, 2011 5:23 PM by Gary Pinkham

    bpmtoesbvars and esbtobpmvars...

    Gary Pinkham Newbie

      I'm using 5.0.2 of the SOA-P (and therefore jBPM3)

       

      I have a workflow that calls an ESBActionHandler.. like this (yes the exception handler is missing):

      <node name="create pdf">

                          <action name="action"

                                    class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">

                                    <esbCategoryName>GeneratePDFApplicationService</esbCategoryName>

                                    <esbServiceName>GeneratePDFApplicationService</esbServiceName>

                                    <bpmToEsbVars>

                                              <mapping bpm="message" esb="BODY_CONTENT" />

                                              <mapping bpm="masterCaseId" esb="masterCaseId" />

                                    </bpmToEsbVars>

                  <esbToBpmVars>

                            <mapping esb="body.pdffile" bpm="attachment" />

                  </esbToBpmVars>

                          </action>

                          <timer duedate="10 seconds" name="timeout" transition="save pdf"/>

                          <transition name="save pdf" to="save pdf">

                          </transition>

                </node>

       

      the GeneratePDFAccplicationService is an ESB Service that runs an XSLT and a custom FOP action.. The custom action adds a variable called pdffile to the body of the message..  like so:

              message.getBody().add(this.attachmentName, baos.toByteArray());

       

      I put in a couple of displays.. One in the custom ESB Action:

      11:07:14,585 INFO  [STDOUT] body variable names:

      11:07:14,585 INFO  [STDOUT] org.jboss.soa.esb.message.defaultEntry

      11:07:14,585 INFO  [STDOUT] masterCaseId

      11:07:14,585 INFO  [STDOUT] xslfo

      11:07:14,585 INFO  [STDOUT] pdffile

      And we leave that node and go onto another node

      11:07:21,536 INFO  [STDOUT] this script is leaving node Node(create pdf)

      11:07:21,545 INFO  [STDOUT] this script is entering node Node(save pdf)

       

      In this node I printed the BPM variables:

      11:07:21,627 INFO  [STDOUT]  BPM variables:

      11:07:21,627 INFO  [STDOUT] message

      11:07:21,627 INFO  [STDOUT] jbpmProcessNodeVersionCounter21_27

      11:07:21,627 INFO  [STDOUT] masterCaseId

       

      No variable called attachment..   So what happened to this:
      <mapping esb="body.pdffile" bpm="attachment" />

       

      I know the body.pdffile variable is there (as seen above)..   Amd I referring to it wrong?  is it not "body."???

       

      thanks for the help!!!

      Gary

        • 1. bpmtoesbvars and esbtobpmvars...
          Mac Ferguson Newbie

          Don't think you need the "body." in the mapping. IIRC the ESB message body map is the implicit start point of the mapping's value lookup so:

           

          <mapping esb="esbVar" bpm="bpmVar" />

           

          Equates (very roughly) to:

           

          processInstance.getContextInstance().setVariable("bpmVar", message.getBody().get("esbVar"));

          • 2. bpmtoesbvars and esbtobpmvars...
            Gary Pinkham Newbie

            that didn't work either.           I put a break point in one of my ESB actions..   and I noticed something odd..    So the BPM process uses ESBActionHandler and IIRC it waits for the response back from the ESB..

             

            "The EsbActionHandler is designed to work as a reply-response type call into the Enterprise Service Bus. Attach it to the node. This is so that the action is called when the node is entered. The EsbActionHandler executes, leaving the node waiting for a transition signal, (which can come from any other thread of execution but will normally be sent by the JBossESB callback service.)"

             

             

            The breakpoint gets hit and I didn't click the proceed.. so I would expect the BPM process to be hanging..  But my log messages from the process that it left the node appear after a second to two..     

             

            Am I reading this wrong?  Also note that at this point the variable from esbToBpmVars is not set..  The next node in the BPM is a custom action and it displays the variables..  The "output" from the ESB action node is not present..    

             

            Thanks!!

            Gary

            • 3. bpmtoesbvars and esbtobpmvars...
              Gary Pinkham Newbie

              Ok..  so it works now.. the answer on the variable name was "body.pdffile"..   just plain "pdffile" did not work..  Also the timeout was occurring too quickly..  Before the service ended so the variable was there as the next step started..

               

              thanks!

              Gary