3 Replies Latest reply on Dec 7, 2007 6:53 AM by kadlecp

    Can jBPM send command messages to esb service?



      I would like to call esb service from jBPM. The esb service consumes
      command messages (eg. esb service looks at Action field of the message, or eg.
      the service looks at message.getBody().get("method")).
      The problem is how to set the Action field, or "method" object from the jBMP....

      One solution: the esb service looks at message.getBody().get("jbpmCurrentNodeName"), and determine what to do
      according to name of the node....

      Can I set the Action field or my custom message object from jBPM?


        • 1. Re: Can jBPM send command messages to esb service?
          Burr Sutter Master

          Could you be a little more detailed about your question?

          We have the concept of processvar to esb message mapping in the EsbActionHandler like so:

           <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
           <mapping jbpm="entireCustomerAsObject" esb="customer" />
           <mapping jbpm="entireOrderAsObject" esb="orderHeader" />
           <mapping jbpm="entireOrderAsXML" esb="BODY_CONTENT" />
           <mapping jbpm="entireOrderAsObject" esb="order" />

          So you could try to use "method" for the esb target name.

          Worst case is you'll have to build your own jBPM Action Handler and use the Service Invoker which is what we are doing under the covers anyway.


          • 2. Re: Can jBPM send command messages to esb service?

            I have one esb service 'MyServiceCategory:MyService'

            The service accepts command messages (command message = message that carries data and what to do with the data). The service reads "action" object from the body map of the message to know what to do.....

            Imagine following process:

            0.I start process by StartProcessSignal accompanied by customer id....

            1. The process synchronously send the message with action "org.example.check_customer_standing" to the esb service. (the message contains customer id as well).

            2. The service returns "OK" or "NOT_OK".

            3. The process checks the standing and if the standing is "NOT_OK", then the process sends the message with action "org.example.delete_customer" to the same esb service (the message contains customer id as well).

            4. the process ends

            I call twice the same esb service from the processdefinition.xml. Where shall write the action names? I would like to see them in the processdefinition.xml. I think that there is only mapping in the processdefinition.xml, but I want to add info (action field and its value)....

            • 3. Re: Can jBPM send command messages to esb service?

              I think it would be greate to be able to set the default value in mapping (like BpmProcessor, it has "value" attribute)

              the definition in processdefinition.xml would look like

               <node name="node2">
               <action name="action2" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
               <mapping jbpm="action" esb="action" value="org.example.displyInfo"/>
               <mapping jbpm="theBody" esb="BODY_CONTENT" />
               <mapping jbpm="theBody" esb="BODY_CONTENT" />
               <transition name="transition3" to="node3"></transition>

              I can not see any other solution of the basic problem that I have sketched out...