Thanks to all,
I solved using a WorkingMemoryEventListener with the objectAsserted( )
method redefined to do fireAllRules( ).   :-)   -Francesco

2006/12/1, Michael Neale <[EMAIL PROTECTED]>:

yeah, lots of ways of doing it, I didn't really want to suggest it though
;)

foreach x in something {
wm.assertObject(x);
wm.fireAllRules();
}

NOT RECOMMENDED (but would probably work) ;)

On 11/30/06, Geoffrey Wiseman <[EMAIL PROTECTED]> wrote:
>
> So when do you want rules executed - each time you assert an object?
> You could decorate working memory to accomplish that.
>
> On 11/30/06, Francesco Campagnola <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > I'd like to know if is possible to make Drools capable of firing rules
> > (and so executing the action parts of the rules) without call every time the
> > fireAllRules() method on the WorkingMemory.
> >
> > In my program I need that every time an activation is created in the
> > Agenda, this activation can be fired automatically.
> >
> > I tried to get this behaviour calling fireAllRules() inside the
> > activationCreated method of an AgendaListener, but this resulted in rules
> > fired two times:
> > I get this output from my modified StateExample
> >
> > ==>[ActivationCreated(1): rule=Bootstrap; tuple=[fid:1:1], ]
> > [BeforeActivationFired: rule=Bootstrap; tuple=[fid:1:1], ]
> > [ObjectModified: handle=[fid:1:2]; old_object=A[FINISHED];
> > new_object=A[FINISHED]]
> > A finished
> > [AfterActivationFired(1): rule=Bootstrap]
> > [ObjectAsserted: handle=[fid:1:2]; object=A[FINISHED]]
> > ==>[ActivationCreated(3): rule=A to B; tuple=[fid:1:2], [fid:2:3], ]
> > [BeforeActivationFired: rule=A to B; tuple=[fid:1:2], [fid:2:3], ]
> > [ObjectModified: handle=[fid:2:4]; old_object=B[FINISHED];
> > new_object=B[FINISHED]]
> > B finished
> > [AfterActivationFired(3): rule=A to B]
> > ==>[ActivationCreated(3): rule=A to B; tuple=[fid:1:2], [fid:2:4], ]
> > [BeforeActivationFired: rule=A to B; tuple=[fid:1:2], [fid:2:4], ]
> > [ObjectModified: handle=[fid:2:5]; old_object=B[FINISHED];
> > new_object=B[FINISHED]]
> > B finished
> > [AfterActivationFired(3): rule=A to B]
> > [ObjectAsserted: handle=[fid:2:5]; object=B[FINISHED]]
> >
> >
> >
> > Any help would be greatly appreciated. - Francesco
>
>
>
>
> --
> Geoffrey Wiseman
>


Reply via email to