Re: [rules-users] Writting a fusion query with specific time intervals

2011-07-12 Thread Wolfgang Laun
On 11 July 2011 18:45, Amila Suriarachchi 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
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Writting a fusion query with specific time intervals

2011-07-11 Thread Amila Suriarachchi
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.

And also how to run a rule just after an event appears?

thanks,
Amila.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Writting-a-fusion-query-with-specific-time-intervals-tp3151010p3159730.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Writting a fusion query with specific time intervals

2011-07-08 Thread Wolfgang Laun
Your windows don't really slide; they are fixed.

It's probably better to add an order event's value into a fact OrderPerHour,
where you have one such fact for each hour, doing this when the event
appears in the system. (Use no-loop on this rule.)

Then, using cron timers, inspect the OrderPerHour fact of the completed
hour.

-W

On 8 July 2011 09:13, Amila Suriarachchi wrote:

> As I understood Drools fusion supports sliding windows which can either
> time
> based on message length based. But can I write a query with specific time
> intervals?
>
> For an example Lets say my CEP engine recive events which has order value.
> Now I want to fire an event if the orders within 8.00 am to 9.00 am have
> less than $4. In generally firing an event if there are less that
> $4
> total order value within any working hour (i.e 8.00 am 5.00 pm)
>
> is it possible to do this?
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Writting-a-fusion-query-with-specific-time-intervals-tp3151010p3151010.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users