1 Reply Latest reply on Oct 23, 2012 8:49 AM by laoma036912

    Right way to create set of rules per user/role & maintain pool of KnowledgeAgent per user ?

    kunal_ransing

      Hi,

      I am new to Jboss Guvnor.

      I am using Jboss Guvnor Drool 5.4.0

      My question is:

      I have many users/role(user or role are related to my project requirement) who are associated with group of rules , so I had created many packages of rules in guvnor.

      In short ,I created set of rules per user/role for using above way.

      Through program, I am creating chageset.xml dynamically as per user having many resources

      & finally create KnowledgeAgent.

      So to save time to create KnowledgeAgent for each request, I am maintaing pool of KnowledgeAgents per user, So next time I can pick it from pool instead of creating again

      And using ,

                                 startResourceChangeScannerService();

                                startResourceChangeNotifierService();

      KnowledgeAgent get updated.

       

      I am doing all this programatically , So is it right way to do it ? Or Any better way provided by Guvnor for set of rules per user/role ?

        • 1. Re: Right way to create set of rules per user/role & maintain pool of KnowledgeAgent per user ?
          laoma036912

          Hi,

               What do you want? Different user/role calls different rules ? Add a user/role have to add a KnowledgeAgent, this seems to be too much trouble.

                Why don't you do this? The User and Rule as a Fact object added to the Session. It fires the rules.

               as follows:

           

                rule "1"

                when

                      User(name=="tom")

                      Role(name=="developer")

                then

                      System.out.println("tom's rules");

               end

               rule "2"   

                when

                     User(name=="mark")

                     Role(name=="manager")

               then

                     System.out.println("mark's rules");

              end

           

              Code is :

           

              User user=new User("tom");

               Role role=new Role("developer");

               session.insert(user);

               session.insert(role);

              

              Result : It fires the rule "1".

           

              So it needs only one package and KnowledgeAgent.

           

              Hope these just what you need.