<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=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<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;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="2050" />
</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=PT link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Hi!<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US>I&#8217;ve detected some problems in my
rules regarding event expiration but I can&#8217;t understand why. Maybe
someone with more experience could help me out.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>I think the example is quite simple: the application
receives transactions. The lack of transactions for an hour should raise an
alarm. If there&#8217;s a transaction when the alarm is on, then the
application should rearm, clear the alarm state and check for lack of
transactions.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;
padding:0cm 0cm 1.0pt 0cm'>

<p class=MsoNormal style='border:none;padding:0cm'><span lang=EN-US>The rules:<o:p></o:p></span></p>

</div>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>package</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
com.company.application;</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>import</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
com.company.application.Notifier;</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>import</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
com.company.application.Notification;</span><span lang=EN-US style='font-size:
10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>import</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
com.company.application.Transaction;</span><span lang=EN-US style='font-size:
10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>dialect</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;java&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'># event which represents
an alarm state<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>declare</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
NoTransactions</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      @role(
event )</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      dummy1:
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>long</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'># event which represents
the start of drools engine<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>declare</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
EngineStarted</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      @role(
event )</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      dummy2
: </span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>long</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:olive'># event which
represents the need to check for absence of transactions for the first hour</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>declare</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
CheckFirstTransaction</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      @role(
event )</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      @expire(
1h )</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      dummy3:
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>long</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:olive'># event which
represents a Transaction</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>declare</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
Transaction</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      @role(
event )</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      @expires(
1h )</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:olive'>#
Notification System</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>global</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
Notifier notifier;</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>rule</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;***start***&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>when</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>not</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
EngineStarted() )</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>then</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>insert</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>( </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>new</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
EngineStarted() );</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>insert</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>( </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>new</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
CheckFirstTransaction() );</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>rule</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;***notrx_after_start***&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>when</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      $engineStarted
: EngineStarted()</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      $checkFirstTransaction
: CheckFirstTransaction() </span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>not</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
NoTransactions() )</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>not</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
Transaction( </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console";color:#960000'>this</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> after[0s,1h]
$engineStarted ) </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console";color:#960000'>from</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> entry-point </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;incoming&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> )
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>then</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>insert</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> (
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console";color:black'> NoTransactions() );</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>retract</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
$checkFirstTransaction );</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      notifier.send(
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console";color:black'> Notification( </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;ALARM&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> )
);</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Lucida Console";color:#960000'>end</span></b><span
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>rule</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;***notrx_after_trx***&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>when</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      EngineStarted()</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>not</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
NoTransactions() )</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      $transaction:
Transaction() </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console";color:#960000'>from</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> entry-point </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;incoming&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>not</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
Transaction( </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console";color:#960000'>this</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> !=
$transaction, </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console";color:#960000'>this</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> after
[0s,1h] $transaction ) </span><b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console";color:#960000'>from</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> entry-point </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;incoming&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> )
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>then</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>insert</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>( </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>new</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>
NoTransactions());</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      notifier.send(
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console";color:black'> Notification( </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;ALARM&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> )
);</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>rule</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;***rearm***&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>when</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      EngineStarted()</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      $noTransactions
: NoTransactions()</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      $transaction:
Transaction( </span><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console";color:#960000'>this</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> after
$noTransactions ) </span><b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console";color:#960000'>from</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'> entry-point </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;incoming&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>then</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>retract</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'>(
$noTransactions );</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Lucida Console"'><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Lucida Console";color:black'>      notifier.send(
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";
color:#960000'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Lucida Console";color:black'> Notification( </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:green'>&quot;REARM&quot;</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console";color:black'> )
);</span><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

<div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;
padding:0cm 0cm 1.0pt 0cm'>

<p class=MsoNormal style='text-autospace:none;border:none;padding:0cm'><b><span
style='font-size:10.0pt;font-family:"Lucida Console";color:#960000'>end</span></b><span
style='font-size:10.0pt;font-family:"Lucida Console"'><o:p></o:p></span></p>

</div>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;
padding:0cm 0cm 1.0pt 0cm'>

<p class=MsoNormal style='border:none;padding:0cm'><span lang=EN-US>The unit test:<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>kSession.fireAllRules();
// needed to detect lack of transactions in the first hour<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>/*
here, &#8220;***start***&#8221; rule fires =&gt; &#8220;EngineStarted&#8221;
and &#8220;CheckFirstTransaction&#8221; inserted */<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>clock.advanceTime(
1, TimeUnit.HOURS );<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>/*
here, &#8220;***notrx_after_start***&#8221; rule fires =&gt; &#8220;NoTransactions&#8221;
inserted, &#8220;CheckFirstTransaction&#8221; retracted */<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>clock.advanceTime(10,
TimeUnit.MINUTES );<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>entryPoint.insert(
new Transaction() );<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>/*
before inserting &#8220;Transaction&#8221; into EntryPoint, &#8220;NoTransactions&#8221;
is retracted */<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Lucida Console"'>kSession.fireAllRules();<o:p></o:p></span></p>

<div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;
padding:0cm 0cm 1.0pt 0cm'>

<p class=MsoNormal style='border:none;padding:0cm'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

</div>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>The problem:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>After inserting the last transaction, automatically
the NoTransactions event is retracted. Debugging inside drools-core project, I&#8217;ve
discovered that the event was retracted because expiration (WorkingMemoryReteExpireAction
on actionQueue). <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>I&#8217;ve also found some more explain how
expiration events works, by Edison (<a
href="http://drools-java-rules-engine.46999.n3.nabble.com/Events-are-not-automatically-expiring-from-working-memory-td61127.html">http://drools-java-rules-engine.46999.n3.nabble.com/Events-are-not-automatically-expiring-from-working-memory-td61127.html</a>).
That shed some light on *<b>when</b>* the event is retracted but I don&#8217;t understand
*<b>why</b>* it&#8217;s retracted.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>Thanks In Advance!<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%"
 style='width:100.0%'>
 <tr>
  <td colspan=2 style='background:#B4CB3D;padding:0cm 0cm 0cm 0cm'>
  <p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img
  border=0 width=389 height=6 id="Picture_x0020_1"
  src="cid:image001.jpg@01CAF746.A5584F80"><o:p></o:p></span></p>
  </td>
 </tr>
 <tr>
  <td style='border:none;border-left:solid black 1.0pt;background:#EBF3CC;
  padding:7.5pt 7.5pt 7.5pt 7.5pt'>
  <p class=MsoNormal><span style='font-size:7.5pt;font-family:"Verdana","sans-serif"'>Vítor
  Mendonça Moreira<br>
  <b><span style='color:#8A9A37'>Analista / Programador<br>
  Direcção de Investigação e Desenvolvimento</span></b><br>
  <br>
  Rua Dr. Francisco Sá Carneiro, nº. 4 r/c esq.<br>
  2500 - 206 - Caldas da Rainha<br>
  Tel: (+351) 262 832 196<br>
  Fax: (+351) 262 186 455<br>
  Web: <a href="http://www.makewise.pt"><span style='color:blue'>www.makewise.pt</span></a><br>
  Uma empresa: <a href="http://www.sousapedro.com"><span style='color:blue'>Grupo
  Sousa Pedro</span></a> <o:p></o:p></span></p>
  </td>
  <td width="1%" style='width:1.0%;background:#EBF3CC;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
  <p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img
  border=0 width=119 height=60 id="Picture_x0020_2"
  src="cid:image002.jpg@01CAF746.A5584F80"><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='height:.75pt'>
  <td style='background:#B4CB3D;padding:0cm 0cm 0cm 0cm;height:.75pt'></td>
  <td style='background:#B4CB3D;padding:0cm 0cm 0cm 0cm;height:.75pt'></td>
 </tr>
</table>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>