Re: [rules-users] RuleBase Question
OK. The reason why I don't want to use KnowledgeAgent is because I want the DRL scanning to be done synchronously once I send a JMX message and not by having the KnowledgeAgent polls the resource folder for changes every x time units. Can I do that? Basically, I want another application to send a signal to start scanning the DRL folder for changed files and then compile and re-add only those that have been modified. I am currently using the file modification time to determine what has changed since last time. Is there a better approach? Right now I have a JMX bean that scans the folder, and grabs the DRLs that got changed, and only recompile those, then re-add them to the RuleBase, then get a new stateful session the next execution. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p889922.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RuleBase Question
Thanks Esteban, 1. I will try that. 2. No, I did not use queries. They are just rules that use functions in my fact object. 2010/6/11 Esteban Aliverti > Hi, > > 1. If you want to dynamically update your kbase whenever your resources > (DRL, PKG, etc) change, you could use Knowledge Agent. Take a look at the > documentation. The KAgent basically makes what you are trying to do. On > thing you must to take care (whether you are using KAgent or not) is that > whenever you modify a kbase you must rebuild all your sessions (unless they > were stateless, of course). > > 2. Does the package you are trying to remove contains queries definitions? > I filled a jira issue some time ago ( > https://jira.jboss.org/browse/JBRULES-2374) reporting this problem. > > Best, > > > On Thu, Jun 10, 2010 at 9:43 PM, malkhafaji wrote: > >> >> Hello, >> >> I have two questions. Hopefully they are very simple: >> >> 1. If I wanted to dynamically update a package in the RuleBase because I >> found out that the drl was updated on disk, can I just do this: >> >> ruleBase.addPackage(myPackage); >> >> And this will automatically replace (remove the old one, and add the new >> one)? Or do I have to implicitly first remove the existing one and THEN >> add >> the modified one again? >> >> I have the following code: >> >> if (ruleBase.getPackage(onePackage.getName()) != null) { >>ruleBase.removePackage(onePackage.getName()); >> } >> ruleBase.addPackage(onePackage); >> >> Is this a code practice to do? >> >> 2. My second question is, the statement above in the body of the IF block, >> threw the following exception: >> >> Exception in thread "AdminHandler_0_123877285495354" >> java.lang.NullPointerException >> INFO|7032/0|10-06-10 13:43:55| at >> org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:235) >> INFO|7032/0|10-06-10 13:43:55| at >> org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:413) >> INFO|7032/0|10-06-10 13:43:55| at >> org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:729) >> INFO|7032/0|10-06-10 13:43:55| at >> >> org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:657) >> INFO|7032/0|10-06-10 13:43:55| at [statement in the IF block above] >> >> Any ideas why that is? >> >> Thanks. >> -- >> View this message in context: >> http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p887326.html >> Sent from the Drools - User mailing list archive at Nabble.com. >> ___ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> > > > > -- > > > Esteban Aliverti > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > -- Moe Alkhafaji Chief Technology Officer, MedCPU Phone: (630) 290-1113 Email: c...@medcpu.com This message contains information which may be confidential. Unless you are the addressee, you may not use, copy or disclose to anyone the message or any information contained in this message. If you have received this email in error, please notify c...@medcpu.com and please delete the message immediately. In order for the contents of this message to be binding on behalf of MedCPU it must be confirmed in writing by an authorized signatory of MedCPU. Our company accepts no liability for the content of this email unless it is so confirmed. The views or opinions presented herein do not necessarily represent those of the company. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RuleBase Question
Hi, 1. If you want to dynamically update your kbase whenever your resources (DRL, PKG, etc) change, you could use Knowledge Agent. Take a look at the documentation. The KAgent basically makes what you are trying to do. On thing you must to take care (whether you are using KAgent or not) is that whenever you modify a kbase you must rebuild all your sessions (unless they were stateless, of course). 2. Does the package you are trying to remove contains queries definitions? I filled a jira issue some time ago ( https://jira.jboss.org/browse/JBRULES-2374) reporting this problem. Best, On Thu, Jun 10, 2010 at 9:43 PM, malkhafaji wrote: > > Hello, > > I have two questions. Hopefully they are very simple: > > 1. If I wanted to dynamically update a package in the RuleBase because I > found out that the drl was updated on disk, can I just do this: > > ruleBase.addPackage(myPackage); > > And this will automatically replace (remove the old one, and add the new > one)? Or do I have to implicitly first remove the existing one and THEN add > the modified one again? > > I have the following code: > > if (ruleBase.getPackage(onePackage.getName()) != null) { >ruleBase.removePackage(onePackage.getName()); > } > ruleBase.addPackage(onePackage); > > Is this a code practice to do? > > 2. My second question is, the statement above in the body of the IF block, > threw the following exception: > > Exception in thread "AdminHandler_0_123877285495354" > java.lang.NullPointerException > INFO|7032/0|10-06-10 13:43:55| at > org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:235) > INFO|7032/0|10-06-10 13:43:55| at > org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:413) > INFO|7032/0|10-06-10 13:43:55| at > org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:729) > INFO|7032/0|10-06-10 13:43:55| at > org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:657) > INFO|7032/0|10-06-10 13:43:55| at [statement in the IF block above] > > Any ideas why that is? > > Thanks. > -- > View this message in context: > http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p887326.html > Sent from the Drools - User mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > -- Esteban Aliverti ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] RuleBase Question
Hello, I have two questions. Hopefully they are very simple: 1. If I wanted to dynamically update a package in the RuleBase because I found out that the drl was updated on disk, can I just do this: ruleBase.addPackage(myPackage); And this will automatically replace (remove the old one, and add the new one)? Or do I have to implicitly first remove the existing one and THEN add the modified one again? I have the following code: if (ruleBase.getPackage(onePackage.getName()) != null) { ruleBase.removePackage(onePackage.getName()); } ruleBase.addPackage(onePackage); Is this a code practice to do? 2. My second question is, the statement above in the body of the IF block, threw the following exception: Exception in thread "AdminHandler_0_123877285495354" java.lang.NullPointerException INFO|7032/0|10-06-10 13:43:55| at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:235) INFO|7032/0|10-06-10 13:43:55| at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:413) INFO|7032/0|10-06-10 13:43:55| at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:729) INFO|7032/0|10-06-10 13:43:55| at org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:657) INFO|7032/0|10-06-10 13:43:55| at [statement in the IF block above] Any ideas why that is? Thanks. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p887326.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users