[rules-users] Major problems with dynamic rules

Michael Neale michael.neale at gmail.com
Wed Jan 24 16:27:38 EST 2007


Hi Justine. From the sounds of it, this is actually the same problem that
you logged in
http://jira.jboss.com/jira/browse/JBRULES-612

Edson has found the problem (for both 3.0.x and trunk) so should have a
resolution for you soon.
It appears to do with some internal caches that need to be cleared when the
network changes, which we hadn't noticed before.

Thanks for raising the issue.

Michael.

On 1/25/07, Justine Hlista <justine at vsasset.com> wrote:
>
> Sure -- I've got a little tar file that contains the isolated example.
> Should I send it to you, or do you want me to create an issue in JIRA?
>
> My current workaround (which is to reference all the fact classes that my
> dynamic rules might be interested in) seems to be working for now, but I
> don't really trust it since it seems so odd.
>
> Thanks!
> Justine
>
> On 1/22/07, Michael Neale <michael.neale at gmail.com> wrote:
> >
> > Hi Justine. It does sound like something is amiss, could you wrap up a
> > unit test for this ? is that possible, then we can slap it to a JIRA and fix
> > it.
> >
> > Thanks,
> >
> > Michael.
> >
> > On 1/23/07, Justine Hlista <justine at vsasset.com> wrote:
> >
> > >  Hello,
> > >
> > > I am having some major problems working with dynamic rules. This may
> > > be a showstopper for us. Perhaps I have missed something in the docs.
> > >
> > > The main problem is significantly different behavior depending on when
> > > I assert facts versus when I read drl files that use them.
> > >
> > > It *appears* that I must class load all potential fact classes by
> > > referencing them in a dummy rule before I assert facts and and begin using
> > > dynamic rules against them. But that is a guess.
> > >
> > > An example:
> > >
> > > I have 2 rule files and 1 fact class (class factA with a String
> > > field1).
> > >
> > > ---------------------
> > > testCase1.drl:
> > > ---------------------
> > > rule Bootstrap
> > >     when
> > >         a : factA(field1=="blah")
> > >     then
> > >         System.out.println("bootstrap: a blah");
> > > end
> > > ---------------------
> > > testCase2.drl:
> > > ---------------------
> > > rule "aIsHello"
> > >     when
> > >         a: factA(field1=="hello")
> > >     then
> > >         System.out.println("a: " + a.getField1());
> > >         a.setField1("world");
> > >         modify(a);
> > > end
> > >
> > > rule "aIsWorld"
> > >     when
> > >         a: factA(field1 == "world")
> > >     then
> > >         System.out.println("Retracted a with field1 = " + a.getField1
> > > ());
> > >         retract(a);
> > > end
> > >
> > >
> > > If I first assert my factA (workingMemory.assertObject( new
> > > factA("hello")) ) before loading either drl file, only rule "aIsHello"
> > > fires.
> > >
> > > If I first load testCase1.drl and then assert factA and then load
> > > testCase2.drl, then both rule "aIsHello" and rule "aIsWorld" both
> > > fire. This is the expected behavior (at least for me).
> > >
> > > If I modify testCase1.drl such that it does not reference class factA
> > > but some other class (e.g. factAtoo), then only rule "aIsHello" fires
> > > (as in the first case).
> > >
> > > I am extremely confused, as I would at least expect the same behavior
> > > in all cases. For our application, it is critical that we be able to assert
> > > facts and modify rules independently and dynamically. What am I missing
> > > about how dynamic rules should work??
> > >
> > > Any help is greatly appreciated!
> > >
> > > Justine
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> > >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> >
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070125/43e18284/attachment.html 


More information about the rules-users mailing list