Hi Wolfgang,<div><br></div><div>I've attached a simple test case, which demonstrates the repetitions. If you run it, you'll see that the rule fires 3 times. [Tested in 5.4]</div><div><br></div><div><div>count = 5, time = 5000ms</div>
<div>count = 5, time = 10000ms</div><div>count = 5, time = 15000ms</div><div><br></div><div>Changing the repeat-interval to 0 has identical results. Changing to a negative number [suggested earlier] causes an infinite loop in Drools.</div>
<div><br></div><div>To clarify, what I'm trying to do is block the rule from firing for the first 5 seconds and then fire normally after that ( as if there was no timer ). For example. The output I'm trying to achieve (not necessarily with timers) is:</div>
<div><br></div><div>count = 5, time = 5000ms</div><div>count = 5, time = 6000ms</div><div>count = 5, time = 7000ms</div><div>count = 5, time = 8000ms</div><div>count = 5, time = 9000ms</div><div>count = 5, time = 10000ms</div>
<div>count = 5, time = 11000ms</div><div>count = 5, time = 12000ms</div><div>count = 5, time = 13000ms</div><div>count = 5, time = 14000ms</div><div>count = 5, time = 15000ms</div><div><br></div><div>Thanks & Regards,</div>
<div><br></div><div>Paul</div><br><div class="gmail_quote">On Thu, Jun 7, 2012 at 7:41 AM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 07/06/2012, Mark Proctor <<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>> wrote:<br>
> On 06/06/2012 18:39, Vincent LEGENDRE wrote:<br>
>> try with a negative number ?<br>
> I would ommit the number all together. I suspect what 0 does is schedule<br>
> with intervals of 0s, thus it fires straight away.<br>
> timer(int: 5s)<br>
<br>
</div>@myself: I really should RFTM before proposing risky (if working) workarounds.<br>
<br>
The OP's claim "if the repeat interval is omitted, it uses the<br>
initial delay as the repeat interval" is, untrue; DRL timer's<br>
definition is in line with all similar APIs and definitions, i.e.,<br>
when the repeat interval is omitted, then it's a one shot timer.<br>
<br>
@Paul: As I wrote in a previous mail - there's got to be another<br>
effect that causes the repetitions. Note that a live timer is<br>
connected to an *activation*, which isn't the same as being connected<br>
to a *rule*:<br>
1 rule - n activations - n timers - x firings.<br>
<span class="HOEnZb"><font color="#888888"><br>
-W<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> Mark<br>
>><br>
>> ----- Original Message -----<br>
>> From: "Paul R."<<a href="mailto:reverselogic@gmail.com">reverselogic@gmail.com</a>><br>
>> To: "Rules Users List"<<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
>> Sent: Mercredi 6 Juin 2012 19:26:22<br>
>> Subject: Re: [rules-users] Initial rule delay<br>
>><br>
>><br>
>> Thanks Wolfgang, but setting the repeat-interval to 0 seems to have the<br>
>> same effect as omitting the repeat-interval [Tested in 5.1& 5.4].<br>
>><br>
>><br>
>> Thanks Vincent, this seems to work. However I was hoping for a simpler<br>
>> solution :)<br>
>><br>
>><br>
>> - Paul<br>
>><br>
>> On Wed, Jun 6, 2012 at 5:06 PM, Vincent LEGENDRE<<br>
>> <a href="mailto:vincent.legendre@eurodecision.com">vincent.legendre@eurodecision.com</a>> wrote:<br>
>><br>
>><br>
>> Yes of course ...<br>
>> Simpler this way ...<br>
>><br>
>><br>
>> ----- Original Message -----<br>
>> From: "Wolfgang Laun"< <a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>><br>
>> To: "Rules Users List"< <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
>><br>
>><br>
>> Sent: Mercredi 6 Juin 2012 18:02:40<br>
>> Subject: Re: [rules-users] Initial rule delay<br>
>><br>
>> Try:<br>
>> timer( int:<initial> 0 )<br>
>> -W<br>
>><br>
>> On 06/06/2012, Paul R.< <a href="mailto:reverselogic@gmail.com">reverselogic@gmail.com</a>> wrote:<br>
>>> Hi,<br>
>>><br>
>>> I'm looking for a way to delay a rules initial execution? In the<br>
>>> following<br>
>>> example, I would like to prevent the rule from firing when the first<br>
>>> "Foo"<br>
>>> event is inserted into the working memory.<br>
>>><br>
>>> rule "DelayTest" when $n : Number() from accumulate( $f : Foo() over<br>
>>> window:time(10s) count($f) ) then // bla end<br>
>>><br>
>>> The timer attribute seems to almost support what I'm looking for, i.e.<br>
>>> it<br>
>>> allows for an initial-delay to be specified; but if the repeat interval<br>
>>> is<br>
>>> omitted, it uses the initial delay as the repeat interval.<br>
>>><br>
>>> timer ( int:<initial delay> <repeat interval>? )<br>
>>><br>
>>> In my case I would like to block the execution of the rule for an<br>
>>> "initial-delay" period, but after that time has elapsed the rule should<br>
>>> fire when every time a new "Foo" event is inserted into the working<br>
>>> memory.<br>
>>> What is the recommended way to do this?<br>
>>><br>
>>> Thanks& Regards,<br>
>>><br>
>>> Paul<br>
>>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>