5 Replies Latest reply on Jan 4, 2013 10:56 AM by David Ward

    Mapping global variables in Switchyard Rules Service

    Avadhut Sardeshmukh Newbie

      Hello All

      First of all, I am a complete newbie to the Java world in general, Jboss and Switchyard in particular. So please excuse for an inappropriate question and point me to a proper place to look for an answer.


      I am trying to expose a Drools rule file as a Switchyard service, and want to return some key-value pairs from the rule file.

      Earlier (before using Switchyard), I had done this by setting an object as a global variable (using "setGlobal" method of "StatefulKnowledgeSession" class) and then inserting key-value pairs into this object inside the rule file. Now I want to do the same thing using Switchyard.


      There is a "globals=" attribute inside the @Rules annotation, but it is not doing what I had expected. I used it as follows :

                                    globals={@Mapping(expression="message.content", variable="output")}

      What it is doing is, it is mapping the object passed as input to the .drl file (using the SendInOnly method), to the variable declared as global (i.e. output). What I expect instead is, these two (input and output) to be two different objects (of different classes). Probably there's a way to use it according to my intended way, but I am not able to get it.

      Please let me know which additional info I can provide to help you better understand my question.

      Will you please help me solve this issue?


      Thanks and regards,

      Avadhut Sardeshmukh