There must be a mechanism for timers to fire. That is either fire fireAllRules or use
fireUntilHalt, rules should not fire outside of those two things. Even if there is a
timer, it simply puts the activation onto the agenda, so it fires with the fireAllRules or
fireUntilHalt life cycles.
Mark
On 20 Jun 2013, at 06:05, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
Experiments (5.[2345].0) show that it's not necessary to use
fireUntilHalt. A rule like
rule "Rule 123"
timer (cron: 0/15 * * * * ?)
when
then
System.out.println("Fired 123!");
end
keeps the timer task alive even when the stateful session isn't
evaluating rules. Just don't dispose() the session.
@Mark: Not executing a due timer when a session is idle would be a
bug, or at least a very severe restriction on the way you run a
session with timers. Not everybody is happy with a session continually
alive with fireUntilHalt.
-W
On 20/06/2013, Mark Proctor <mproctor(a)codehaus.org> wrote:
> try fireUntilHalt, or it won't be able to fire the events as they happen.
>
> Mark
> On 20 Jun 2013, at 02:04, Andy <reliable.android(a)gmail.com> wrote:
>
>> *Issue 1*
>>
>> Steps:
>> 1. Add a Rule with cron + when condition always true.
>> 2. FireAllRules
>>
>> Expected: Cron to fire every 15 seconds
>>
>> Rule:
>> "
>> rule "Rule 123" dialect "mvel"
>> timer (cron:0/15 * * * * ?)
>> when
>> eval(true)
>> then
>> System.out.println("Fired!");
>> end
>> "
>>
>> Other Details:
>> "
>> ...(initialized kagent using changeset)
>> kbase = kagent.getKnowledgeBase();
>> ksession = kbase.newStatefulKnowledgeSession();
>> ksession.fireAllRules();
>> "
>>
>> The same rule works fine when I insert some object.
>>
>> *Issue 2*
>> Inserting some object and then adding a second cron makes the previous
>> cron
>> fire twice, then thrice and so on...
>>
>> Is statefulknowledge session right choice for me?
>> Are there any known issues with cron rules?
>>
>> Any help/advice is appreciated. Thx!
>>
>>
>>
>> --
>> View this message in context:
>>
http://drools.46999.n3.nabble.com/Cron-Rule-doesn-t-work-tp4024399.html
>> Sent from the Drools: User forum mailing list archive at
Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users