3 Replies Latest reply on Dec 6, 2011 7:08 AM by while_true

    Get JBOSS ESB Variables in jBPM ActionHandler

    kuptservol

      The question is how I can get mapped variable in jBPM ActionHandler?(f.e. from executionContext)

       

      I start jbpm process from esb with mapping variables:

       

      <action name="create_new_process_instance"
                          class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
                          <property name="command" value="StartProcessInstanceCommand" />
                          <property name="process-definition-name" value="process"/> 
                          <property name="esbToBpmVars">
                             <mapping esb="body.fullname" bpm="fullname" />
                             <mapping esb="messageContent" bpm="bpmMessageContent" /> 
                             <mapping esb="BODY_CONTENT" bpm="theBody" /> 
                          </property> 
      </action>
      

      When i go to the ActionHandler class on some node in jBPM process i can't get this variables.

       

      In a way like this:

      public void execute(ExecutionContext executionContext) throws Exception{
      executionContext.getContextInstance().hasVariable("fullname");
      executionContext.getContextInstance().hasVariable("bpmMessageContent");
       executionContext.getContextInstance().hasVariable("theBody");}
      

      I get false.

        • 1. Re: Get JBOSS ESB Variables in jBPM ActionHandler
          while_true

          Hey Sergey,

           

          Just so I can situate myself, can you please make some kind of scenario to what you want to do?

          Are you calling your jBPM process directly from the console, from a Java class... You know what I mean?

           

          Grateful for your attention.

           

          Best regards.

          • 2. Re: Get JBOSS ESB Variables in jBPM ActionHandler
            kuptservol

            "You know what I mean", - Not very.

             

            I'm not calling jBPM process. This is done by special JbossEsb action "create_new_process_instance" in my jboss-esb.xml/

            Just like this:

            http://docs.redhat.com/docs/en-US/JBoss_Enterprise_SOA_Platform/4.2/html/SOA_ESB_JBPM_Integration_Guide/esbtojbpm.html

            • 3. Re: Get JBOSS ESB Variables in jBPM ActionHandler
              while_true

              Sergey,

               

              Well perhaps the problem is because you're not passing any value (nor default) to your variables...

               

              Try do something like this:

               

              <action name="create_new_process_instance"
                   class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
                   <property name="command" value="StartProcessInstanceCommand" />
                   <property name="process-definition-name" value="process"/> 
                   <property name="esbToBpmVars">
                        <mapping esb="eVar1" bpm="counter" value="45" />    <!-- Try this one... -->
                        <mapping esb="body.fullname" bpm="fullname"/>
                        <mapping esb="messageContent" bpm="bpmMessageContent"/> 
                        <mapping esb="BODY_CONTENT" bpm="theBody" /> 
                   </property> 
              </action>
              

               

              And where one can read value, one can also have default.

               

              Try it and then let us know how it went.

               

              Grateful for your attention.

               

              Best regards.