<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I&#8217;m grateful for the clarification that the timer behavior is changing in Drools 6.&nbsp; I was planning on exploiting the Drools 5 behavior to fire certain rules
 asynchronously at intervals using a timer, even when the engine was otherwise idle.&nbsp; I don&#8217;t want to use fireUntilHalt because I need to make numerous updates to facts in a batch in Java code, and I don&#8217;t want any rules to fire prematurely.&nbsp; To prepare for
 Drools 6, then, it looks like I should use Java to implement the timer, update the working memory, and call fireAllRules.&nbsp; I&#8217;d prefer to be able to specify this declaratively in the DRL file as I can now in Drools 5, but since I want to future-proof my code
 I&#8217;ll need a different approach.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Best wishes,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Tom<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b>On Behalf Of </b>Wolfgang Laun<br>
<b>Sent:</b> Monday, June 24, 2013 4:02 PM<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] Timers and fireAllRules<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">You just make sure that the documentation for 5.x remains as I've added it, and that it is updated accordingly for the 6.x Expert manual.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I don't think that the behaviour in 5.x when fireAllRules() is called and repeating timers execute their tasks even when the Engine is idle is evil. The general flow of logic is consistent even though some executions
 happen later compared to what would happen when running in fireUntilHalt.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">But you can indeed uphold the position that any timer activity is in conflict with the Engine being suspended after fireAllRules() returns. But what should be the consequence? Delay the return? Terminate the
 timers? Disallow timers being launched in a run initiated by fireAllRules()? Let's hope that 6.x reacts cleanly...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-W<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<o:p></o:p></p>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On 24 June 2013 21:05, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">btw sorry about the confusion. The reason was we have changed the behaviour in 6, and in the mean time I'd forgotten what the exact behaviour was in 5.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">In 6.x there is no async behaviour, for fireAllRules, &nbsp;all action happens in the user thread. &nbsp;So there will be no rule firing if fireAllRules (passive mode) is not called, or you are not using fireUntilHalt (reactive mode).&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">There have been several discussion on IRC, and the conclusion was were very uncomfortable with async operations of timers, in passive mode. If people want reactive behaviour, they should use the engine in reactive mode, if they want passive
 behaviour, they should use the engine in passive mode.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Timers &nbsp;are no longer part of &nbsp;Agenda, and instead we have a TimerNode that lives in the network. It's role is simply to control tuple propagation. The code is a lot simpler and more isolated than 5.x, this is also very helpful (if not
 necessary) in the multi-core work we plan to do.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java" target="_blank">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">We do think there may be some future use cases for a mixed hybrid/passive execution mode. Where some rules are passive, some reactive, but we'd rather that we found a way to do this declaratively.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Mark<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal">On 22 Jun 2013, at 07:17, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt; wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">Added to <a href="https://github.com/droolsjbpm/drools/tree/master/drools-docs/drools-expert-docs/src/main/docbook/en-US/Chapter-LanguageReference" target="_blank">
Chapter-LanguageReference</a> / <strong>Section-Rule.xml</strong> on master.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-W<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On 20 June 2013 22:55, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">OK, and now? You can wrap it into a couple of docbook tags and add it to the Expert manual, I'm not reserving the copyright ;-)<o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="color:#888888">-W</span><o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On 20 June 2013 21:29, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">I assumed you were quoting from some documentation.<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="color:#888888">Mark</span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal">On 20 Jun 2013, at 17:08, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt; wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">You sound absolutely sibyllic. Which documentation will you update - I'm not aware of any documentation describing the behaviour of timers. What, in your opinion, was the &quot;behaviour in an older version&quot;? And
 what &quot;older version&quot; are you referring to anyway? I've ascertained that what I described is the behaviour in 5.1.1, 5.2.0, 5.3.0, 5.4.0 and 5.5.0.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">And: where is it written that execution tied to a repeating timer &quot;must be constrained within fireAllRules?&quot; I could make a very good case for arguing that RHS executions due to timer expiry aren't &quot;firing&quot;
 in the classic sense - that's just what happens when the LHS matches.<o:p></o:p></p>
</div>
<p class="MsoNormal">-W<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On 20 June 2013 15:44, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">We'll update the documentation, that was probably the behaviour in an older version. The behaviour should not have rules async firing, unless there is proper async controls, as with fireUntilHalt, otherwise the firings must be constrained
 within fireAllRules.<br>
<br>
Mark<o:p></o:p></p>
<div>
<p class="MsoNormal">On 20 Jun 2013, at 12:04, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt; wrote:<br>
<br>
&gt; &nbsp; &nbsp;A rule controlled by a timer becomes active when it matches, and<br>
&gt; &nbsp; &nbsp;once for each individual match. Its consequence is executed<br>
&gt; &nbsp; &nbsp;repeatedly, according to the timer's settings. This stops as soon<br>
&gt; &nbsp; &nbsp;as the condition doesn't match any more.<br>
&gt;<br>
&gt; &nbsp; &nbsp;Consequences are executed even after control returns from a call<br>
&gt; &nbsp; &nbsp;to fireUntilHalt(). Moreover, the Engine remains reactive to any<br>
&gt; &nbsp; &nbsp;changes made to the Working Memory. For instance, removing a fact<br>
&gt; &nbsp; &nbsp;that was involved in triggering the timer rule's execution causes<br>
&gt; &nbsp; &nbsp;the repeated execution to terminate, or inserting a fact so that<br>
&gt; &nbsp; &nbsp;some rule matches will cause that rule to fire. But the Engine is<br>
&gt; &nbsp; &nbsp;not continually active, only after a rule fires, for whatever<br>
&gt; &nbsp; &nbsp;reason. Thus, reactions to an insertion done asynchronously will<br>
&gt; &nbsp; &nbsp;not happen until the next execution of a timer-controlled rule.<br>
&gt;<br>
&gt; &nbsp; &nbsp;Disposing a session puts an end to all timer activity.<br>
&gt;<br>
&gt; &nbsp; &nbsp;-W<o:p></o:p></p>
</div>
<p class="MsoNormal">&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
&gt; <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" target="_blank">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><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<p class="MsoNormal"><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><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</body>
</html>