<br> Jason,<br><br> Yes, the engine does not see any change in TestObject until you call update() for it.<br> In your case, I would play that a bit different:<br><br>rule "remove objects older than 2 seconds"
<br>when<br> Clock( $cur : currentTime )<br> $to : TestObject( creationTime < ( $cur - 2000 ) )<br>then<br> System.out.println(new java.util.Date() + " ========= Retracting " +<br>$to);<br>
retract($to);<br>end<br><br> This way you only need to update your clock object and not your testObjects.<br><br> []s<br> Edson<br><br><br><div><span class="gmail_quote">2007/7/6, Jason Vasquez <<a href="mailto:jason@mugfu.com">
jason@mugfu.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,<br><br>I need a set of rules to fire on time-based criteria. I have a
<br>'Clock' object in working memory, along with an unknown number of<br>'TestObject's, each of which can report its 'age'. At some interval,<br>I modify the Clock object in working memory, and then fire the
<br>rules. As a start (which I'm certain shouldn't work anyway), I'm<br>playing around with a rule like this:<br><br>rule "remove objects older than 2 seconds"<br>when<br> Clock()<br> $to : TestObject( ageInMillis > 2000 )
<br>then<br> System.out.println(new java.util.Date() + " ========= Retracting " +<br>$to);<br> retract($to);<br>end<br><br>It appears that the RHS is never executed, presumably because<br>TestObjects were not modified. (I'm new to JBossRules, so I'm
<br>unclear on that )<br><br>Alternatively, I could just remove the Clock() constraint and iterate<br>an external collection of TestObject's, marking each object as<br>modified. Just looking for the best way here...<br>
<br>Thanks,<br>-jason<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>