<br> Samir, <br><br> I downloaded your code, but it seems incomplete... <br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2008/3/10, samirsss <<a href="mailto:samirsavla@gmail.com">samirsavla@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br> Hi Edson,<br> <br> I tried the exact method you asked me to and seems like now i am getting an<br> error while I add the rule. Also the rules still dont get fired.<br> <br> I'm going to send you the code again and maybe you can fix it and send it<br>
back to me after testing that all 3 scenarios for the messageId = Test,<br> Test2 and Test3 pass.<br> <br> thanks<br> Samir<br> <br> <a href="http://www.nabble.com/file/p15950841/TestDynamicRules.zip">http://www.nabble.com/file/p15950841/TestDynamicRules.zip</a><br>
TestDynamicRules.zip<br> <br><br> Edson Tirelli-3 wrote:<br> ><br> > Samir,<br> ><br> > I had a look at the code you sent me and the problem is that you are<br> > not<br> > adding the rule to the rulebase. In your<br>
> ConnectionHandler.testDynamicRules()<br> > method, you need to do:<br> ><br> > ruleBase.addPackage( builder.getPackage() );<br> ><br> > You probably incurred in this error because you are misusing the<br>
> Package<br> > objects. You should either remove the whole package from the rule base<br> > before doing your merge or, what I think is best, create a package with<br> > the<br> > "delta" rules you want to add.<br>
> So, instead of doing:<br> ><br> > Package defaultPackage = pkg[0];<br> ><br> > Do:<br> ><br> > Package defaultPackage = new Package( pkg[0].getName() );<br> ><br>
> So, you are effectively creating a new Package object, but when you add<br> > it to the rule base, it will be correctly merged into the existing one.<br> > This also allows you to AVOID the lock you are doing here:<br>
><br> > ruleBase.lock(); // no need for that if you use a new<br> > package<br> > with the same name<br> > packageDescr.addRule( ruleDescr );<br> > builder.addPackage(packageDescr);<br>
> ruleBase.unlock(); // no need for that if you use a new<br> > package with the same name<br> ><br> > Hope it helps.<br> ><br> > Edson<br> ><br> <br>--<br> View this message in context: <a href="http://www.nabble.com/Cant-seem-to-fire-a-dynamically-added-rule-tp15810172p15950841.html">http://www.nabble.com/Cant-seem-to-fire-a-dynamically-added-rule-tp15810172p15950841.html</a><br>
<br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br> <br> _______________________________________________<br> <br>rules-users mailing list<br> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br> </blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br>
Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>