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