[rules-users] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread rvkhakhkhar1
I have a rule which fires let's say every 5 secs.
I have thread which continously infuse facts to ksession simultaneoulsy.
For example,
At 5th sec, 
 I have 500 matching facts, with total 1000 facts

Before the next invocation I infuse another 1000 facts.
So, at 10th sec,
 Rule considers whole working memory including previously evaluated facts. I
expected only new facts to be evaluated as I'm running stateful session



--
View this message in context: 
http://drools.46999.n3.nabble.com/Timer-Cron-reevaluating-same-facts-again-and-gain-tp4019422.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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread Wolfgang Laun
How do you determine when a "fact is evaluated"?

On 29/08/2012, rvkhakhkhar1  wrote:
> I have a rule which fires let's say every 5 secs.
> I have thread which continously infuse facts to ksession simultaneoulsy.
> For example,
> At 5th sec,
>  I have 500 matching facts, with total 1000 facts
>
> Before the next invocation I infuse another 1000 facts.
> So, at 10th sec,
>  Rule considers whole working memory including previously evaluated facts.
> I
> expected only new facts to be evaluated as I'm running stateful session
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Timer-Cron-reevaluating-same-facts-again-and-gain-tp4019422.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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread Vincent LEGENDRE
"I expected only new facts to be evaluated as I'm running stateful session" 

It only works this way if you let your session alive in a separate Thread, 
using fireUntilHalt(). 
If you use fireAllRules() (by instance each 5s), then yes, everything will be 
re-evaluated, just as if it were a new session. 

NB : I hope you have something to clean up your facts too ! 

- Mail original -

De: "rvkhakhkhar1"  
À: rules-users@lists.jboss.org 
Envoyé: Mercredi 29 Août 2012 11:58:51 
Objet: [rules-users] Timer Cron reevaluating same facts again and gain 

I have a rule which fires let's say every 5 secs. I have thread which 
continously infuse facts to ksession simultaneoulsy. For example, At 5th sec, I 
have 500 matching facts, with total 1000 facts Before the next invocation I 
infuse another 1000 facts. So, at 10th sec, Rule considers whole working memory 
including previously evaluated facts. I expected only new facts to be evaluated 
as I'm running stateful session 

View this message in context: Timer Cron reevaluating same facts again and gain 
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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread rvkhakhkhar1
I'm maintaining count for each successful match.
So, let's say, if in next phase there are another 500 successful facts, the
count becomes 1500.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019426.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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread Wolfgang Laun
On 29/08/2012, rvkhakhkhar1  wrote:
> I'm maintaining count for each successful match.

Where, *exactly*, do you increment this counter?


> So, let's say, if in next phase there are another 500 successful facts, the
> count becomes 1500.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019426.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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread rvkhakhkhar1
I'm using fireUntilHalt(). Then too it's happening
I can't retract facts, as there might be other rule to be evaluated for
facts. ( which too have cron timer. So If I remove facts and when that rule
becomes active, there would be no firing)



--
View this message in context: 
http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019427.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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread rvkhakhkhar1
In consequence part of the rule, there is a method call which increment the
count by one for each successful match



--
View this message in context: 
http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019429.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] Timer Cron reevaluating same facts again and gain

2012-08-29 Thread Wolfgang Laun
There you are not counting "evaluations of facts" but "executions of a rule".

If you have a timer on a rule with timer(5s 5s) it will fire for each
and every matching fact or combination of facts, as long as this match
continues for this particular fact or fact combination.

-W


On 29/08/2012, rvkhakhkhar1  wrote:
> In consequence part of the rule, there is a method call which increment the
> count by one for each successful match
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019429.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] Timer Cron reevaluating same facts again and gain

2012-08-30 Thread rvkhakhkhar1
That means, a rule with timer don't remeber for which facts it has executed
consequence part previosly and when its time arrive it just execute
consequence part on available facts.
I checked using AgendaListner, just after rule fire(afterActivationFired)
isActive becomes false, but for the next time in beforeActivationFired the
same fact's isActive become true.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019437.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] Timer Cron reevaluating same facts again and gain

2012-08-30 Thread Wolfgang Laun
On 30/08/2012, rvkhakhkhar1  wrote:
> That means, a rule with timer don't remeber for which facts it has executed
> consequence part previosly and when its time arrive it just execute
> consequence part on available facts.

A rule never "remembers" anything, with or without timers.

A rule with a timer results in an activation which is a combination of a rule
and a tuple of matching facts; one rule may have any number of pending
activations at any time.

An activation of a rule with a timer will become reactivated (after
having been fired before) when the timer fires again and the rule
condition still holds for the associated tuple of fact.

-W


> I checked using AgendaListner, just after rule fire(afterActivationFired)
> isActive becomes false, but for the next time in beforeActivationFired the
> same fact's isActive become true.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019437.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] Timer Cron reevaluating same facts again and gain

2012-08-30 Thread rvkhakhkhar1
Thanks buddy. Fully got the concept.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Timer-Cron-re-evaluating-same-facts-again-and-again-tp4019422p4019444.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