On 11 July 2011 18:45, Amila Suriarachchi
<amilaSuriarachchi@gmail.com> wrote:
yes it is a fixed window.
How to use the 'cron timers' in a rule file I am bit new to fusion. so if
you show me an article or a code segment regarding this that would be fine.
rule OneMinutesPastEveryFullHour
timer( cron: * 1 * * * ? )
when
then
// get current hour, access counter,...
end
You might use additional values (e.g., 9-17 for the "hour" field, i.e., '*' after '1').
See
man -s 5 crontab
for more info. Notice that Drools timer/crontab has an additional leading field for seconds.
And also how to run a rule just after an event appears?
This assumes that you do not modify Event here or elsewhere. Using a global array with 24 integers initialized to 0 you can do:
rule newEvent
when
$e: Event()
then
// Count new event
globalCounter[hourOf( $e.getTimestamp() )]++;
end
thanks,
Amila.
--
View this message in context: http://drools.46999.n3.nabble.com/Writting-a-fusion-query-with-specific-time-intervals-tp3151010p3159730.html