[rules-users] Updating interval events

Wolfgang Laun wolfgang.laun at gmail.com
Thu Nov 11 08:02:59 EST 2010


On 11 November 2010 11:11, anais <amartinez at iti.upv.es> wrote:
>
> Hello.
>
> I'm using Drools in a system of alarms.  I have a drl file with rules in
> wich I have defined events that are java classes. I have defined timed
> events and interval events. My idea is that an external timer inserts some
> interval events time to time. Well, the thing is that I need update an
> interval event if another event appears.
>
> I have read somewhere in documentation that updating an event is equal to
> remove it and insert a new event with the changes made.

I think that this paragraph (Expert 3.3.3.1.3. Update) contains several
obsolete statements.

<quote>
The Rule Engine must be notified of modified facts, so that they can
be reprocessed.
<rem>OK</rem>
 Internally, modification is actually a retract followed by an insert;
the Rule Engine removes the fact from the WorkingMemory and inserts it
again.
<rem>This isn't literally true. For instance, the fact handle isn't
recreated, and this is where the automatic timestamp resides.</rem>
 You must use the update() method to notify the WorkingMemory  of
changed objects for those objects that are not able to notify the
WorkingMemory themselves. Notice that update() always takes the
modified object as a second parameter, which allows you to specify new
instances for immutable objects. The update() method can only be used
with objects that have shadow proxies turned on.
<rem>A long time ago, perhaps.</rem>
 The update method is only available within Java code.
<rem>Not true, it can be used in RHS code as well.</rem>
 On the right hand side of a rule, also the modify statement is
supported, providing simplified calls to the object's setters.
<rem>Usually preferred to setter calls followed by update().</rem>
</quote>


> If I update an
> interval event, will its timestamp change?
No.

> That is, if I update an interval
> event, the moment that this event finishes will be delayed?
No.

> The problem will
> be solved if I assign its timestamp to one property of the event?
No need to do this, I'd say.

-W

>
> Thanks in advance.
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Updating-interval-events-tp1881686p1881686.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
>




More information about the rules-users mailing list