2 Replies Latest reply on Jan 10, 2014 10:29 AM by Anton Hughes

    Knowledge Services  questions - dynamic properties, dynamic sessions?

    Anton Hughes Master



      We currently use SY 0.8 and we have a rule service that uses drools 5.5 (when we started development Drools 6 was not released).


      We are researching how we can achieve current and future functionality in a more recent version of SY and Drools.


      It would be good if we can use the SY rules service - as SY does a good job at abstracting away much of the integration points.


      My questions, therefore, are:


      Is it possible to set a variable session name and if yes, how would we set this value? For example:


      <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">


          <kbase name="com.example">

              <ksession name="${kieSessio}"/>




      I see in the documentation that:


      Properties are an advanced topic, so setting them should be done with care.  All possible property names and values will not be listed here, but as a starting point, in your IDE open up a Type Heirarchy with a root of org.kie.api.conf.Option. That is your full list. Here are just a couple examples:




          <property name="drools.clockType" value="pseudo"/>

          <property name="drools.eventProcessingMode" value="stream"/>



      Are these values entered on the Domain tab of the switchyard.xml? If yes, I was not getting the Type Heirachy (perhaps a bug?).

      Could this be another place to set the KieSession?

        • 1. Re: Knowledge Services  questions - dynamic properties, dynamic sessions?
          David Ward Master

          First off, there is a difference between SwitchYard Properties and Drools properties (otherwise known as "Options").


          Drools Options are properties that can be set using SwitchYard configuration, and the names and values of which can be dynamically replaced using the dollar-curly format.  The Drools Options themselves configure the rules engine, and the full range of possibilities can be discovered using the Type Hierarchy in Eclipse as the documentation suggests.  Why getting the hierarchy in Eclipse doesn't work for you, I don't know, but here is a screenshot of it from me:




          Where you set those Drools properties is in the <implementation.rules><properties> section of your switchyard.xml.  If you want those Drools properties to have dynamically replaceable values (using the dollar-curly format), you can set the replacement values at the component level, or at the domain level, or as system properties. Anything that we support as sources, according to the Properties documentation.


          I wanted to reiterate all of the above just so everyone is clear on the usage of properties within SwitchYard's rules component.  However, to answer your original question of having a variable session name, the answer to that is a "no" - sort of.


          To be clear, we can only do dynamic property substitution of xml values inside META-INF/switchyard.xml.  We cannot do that within META-INF/kmodule.xml, since we don't handle it's parsing.  That's the "no" part.  The "sort of" part is that if you can use property replacement for the session name in switchyard.xml, like so: <implementation.rules><manifest><container sessionName="${mySessName}"/>  However, I can see that only being able to do that is of limited usefulness.


          Hope this clears things up.

          • 2. Re: Knowledge Services  questions - dynamic properties, dynamic sessions?
            Anton Hughes Master

            Thank you Mr Ward, that is exceptionally helpful.