Jason,

   Yes, the engine does not see any change in TestObject until you call update() for it.
   In your case, I would play that a bit different:

rule "remove objects older than 2 seconds"
when
        Clock( $cur : currentTime )
        $to : TestObject( creationTime < ( $cur - 2000 ) )
then
        System.out.println(new java.util.Date() + " ========= Retracting " +
$to);
        retract($to);
end

   This way you only need to update your clock object and not your testObjects.

   []s
   Edson


2007/7/6, Jason Vasquez < jason@mugfu.com>:
Hi all,

I need a set of rules to fire on time-based criteria.  I have a
'Clock' object in working memory, along with an unknown number of
'TestObject's, each of which can report its 'age'.  At some interval,
I modify the Clock object in working memory, and then fire the
rules.  As a start (which I'm certain shouldn't work anyway), I'm
playing around with a rule like this:

rule "remove objects older than 2 seconds"
when
        Clock()
        $to : TestObject( ageInMillis > 2000 )
then
        System.out.println(new java.util.Date() + " ========= Retracting " +
$to);
        retract($to);
end

It appears that the RHS is never executed, presumably because
TestObjects were not modified.  (I'm new to JBossRules, so I'm
unclear on that )

Alternatively, I could just remove the Clock() constraint and iterate
an external collection of TestObject's, marking each object as
modified.  Just looking for the best way here...

Thanks,
-jason
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com