[rules-users] Drools Timers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[rules-users] Drools Timers

calcacuervo
Hey Guys, I am trying to use to use the timer in the rule, but I don't fully understand it.
I have a simple rule which says

rule "Test"

timer(int: 1s)
    when
       Something()
    then
       System.out.println("Something Happens");
end

And I insert 100 Someting() object, after 1 second I see 100 activations.
- Can I do with the timer something like "run this rule once per minute" for example?
- When does the timer start to run? 

Thanks in advance,

Demian

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools Timers

salaboy
Hi Demian,
As far as I remember you can use a CRON like expression in the timer definition which will allow you to do that exactly. 


On Wed, Sep 24, 2014 at 4:59 AM, Demian Calcaprina <[hidden email]> wrote:
Hey Guys, I am trying to use to use the timer in the rule, but I don't fully understand it.
I have a simple rule which says

rule "Test"

timer(int: 1s)
    when
       Something()
    then
       System.out.println("Something Happens");
end

And I insert 100 Someting() object, after 1 second I see 100 activations.
- Can I do with the timer something like "run this rule once per minute" for example?
- When does the timer start to run? 

Thanks in advance,

Demian

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



--
 - MyJourney @ http://salaboy.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools Timers

Federico Bertola
In reply to this post by calcacuervo
Hi all,
I've a big rule file that contains *many* rules like this:

rule "rule1"
when
    $obj1: OBJ(a==false, b=="C")
    $obj2: OBJ(b=="B", a==false)
then
 <...>
end


Inspecting the RETE tree I've noticed that the first layer contains two alpha node, one for "a==false" and one for "b=="B", than the second layer contains the duplicate alpha node for "a==false" and one for "b==C". This is somewhat (at least for me) counter intuitive, because I thought the algorithm would  be a little bit smarter trying to order the clauses from the most restrictive to the least.
I there a particular reason why this optimization it's not implemented? It's difficult or semantically incorrect?

I've noticed this because compiling this file with many rules which have no particular order on clauses led to a tree with a extremely large first level. This obviously was detrimental but a simple ordering of the clauses fixed it.
This became a problem only when we upgraded form 5.0.1 to 6.1.0-Final. Why I didn't noticed any performance problem with the previous version of Drools?

Thanks in advance.

Federico.

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users