[rules-users] Time constrained rules

Jason Vasquez jason at mugfu.com
Fri Jul 6 14:29:49 EDT 2007


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2413 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20070706/1d255177/attachment.bin 


More information about the rules-users mailing list