[rules-users] How to get a rule fired when the object is not changed?

Michael Suzio msuzio at gmail.com
Sat Jan 13 11:22:59 EST 2007


Why couldn't the object itself know when the due date has passed?  If you
kept calling fireAllRules periodically in a thread, and had a rule like:

when
  Order (dueDatePassed == true)
then
 // do something
end

Then you just need a isDueDatePassed method in the Order object, which
itself compares the due date to the current time.

On 1/13/07, Faizan <fraza123 at yahoo.com> wrote:
>
>
> As i understand the rules get fired on a fact/object when it is modified
> and
> the workingMemory is notified of the change. I have a requirement where
> one
> attribute of a fact is time based (due date of an Order object) which is a
> static field but i need to run a thread that periodically compares the
> current date with this attribute so that i can fire a rule when the system
> date matches with the due date. Now since the object is not modified
> simply
> calling fireAllRules() by this thread is not working for me.
> A workaround that i have is to retract and assert (or modify) that object
> everytime that thread calls fireAllRules()  but in that case i need to
> call
> modify on all Order objects lying in the working memory. Is there any
> better
> way to achieve this?
>
> thanks,
> Faizan
> --
> View this message in context:
> http://www.nabble.com/How-to-get-a-rule-fired-when-the-object-is-not-changed--tf2970664.html#a8312507
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070113/bf902aa0/attachment.html 


More information about the rules-users mailing list