Inline.<br><br><div class="gmail_quote">2011/7/25 Melton, Michael P CTR SPAWARSYSCEN-ATLANTIC, 01200 <span dir="ltr">&lt;<a href="mailto:michael.melton.ctr@navy.mil">michael.melton.ctr@navy.mil</a>&gt;</span>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><p># If two WorkerInWorkEvents exist for a worker, there must be a WorkerOutOfWorkEvent between them <br>
rule &quot;ERROR: Consecutive WorkerInWorkEvents&quot; <br>        when <br>                $w1 : WorkerInWorkEvent( $workerId : workerId ) <br>                $w2 : WorkerInWorkEvent( workerId == $workerId, this after $w1 ) <br>
                not WorkerOutOfWorkEvent( workerId == $workerId, this after $w1, this before $w2 ) <br>        then <br>                errors.add(&quot;Two WorkerInWorkEvents without a WorkerOutOfWorkEvent in between (&quot; + $w2 + &quot;)&quot;); <br>
                retract( $w2 ); <br>end </p></div></blockquote><div>I&#39;d say that &quot;this after $w1&quot; makes the Engine wait for ever since after is not bounded. That the truth of $w2 after $w1 is established before the not needs to be evaluated and that this, in combination with &quot;this before $w2&quot; effectually limits the waiting as soon as the second CE is matched is something that would need symbolic expression interpretation - something that&#39;s not so easy to  program.<br>
<br>Feel free to raise a JIRA if you think otherwise.<br><br>However, temporal reasoning with several &quot;flank&quot; events is tricky. My advice would be to try retain at most one of each kind in WM, and combine them into a WorkerWorking event with a duration as soon as possible. Then<br>
   - a WorkerOutOfWorkEvent without a matching WorkerInWorkEvent is an error and retracts it<br>   - a WorkerOutOfWorkEvent with a matching WorkerInWorkEvent creates a WorkerWorking event and retracts both<br>   - a WorkerInWorkEvent during a WorkerWorking is an error etc.<br>
   - (etc)<br><br>-W <br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<p>I could see via the log that this file was activating, however it was never firing.  The retraction of $w2 should have cancelled other rules&#39; activations, but it wasn&#39;t doing so because this rule was never firing.  I just discovered a thread (<a href="http://drools.46999.n3.nabble.com/Drools-fusion-and-absence-of-events-td51125.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-fusion-and-absence-of-events-td51125.html</a>) which finally explained to me the reason why:  I was running in STREAM mode, and the engine was waiting to see if a WorkerOutOfWorkEvent timestamped between the two WorkerInWorkEvents was going to show up.  When I switched to CLOUD mode, the rule fired as expected and my other activations were cancelled as I expected. </p>

<p>Now, my new question is:  Since I have not specified any intervals, how long will the engine wait for the WorkerOutOfWorkEvent to show up?  Forever? </p>
<p>Thanks in advance for any light you can shed on this. </p>
<p>Mike</p></div>
<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></blockquote></div><br>