<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>You've answered your own question. :)&nbsp; The rule you've given will only fire when the object is asserted or modified. (And you have to inform the engine of the modification.)&nbsp; You have to inform the engine that the object has been modified every cycle. (And if you want the engine to fire that rule even if the object has not been modified, you can still inform the engine.&nbsp; All that does is force the rules to reconsider the object.)<br><br>However, the way I'd do it is to have a new object that is inserted on each iteration.&nbsp; Let's call it "Cycle" and give it a count. Then your rule would look like this:<br><br><p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">rule "Identify Java
Objects"</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp; lock-on-active</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">when</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp; $<u><font color="black"><span style="color: black;">mo</span></font></u> : MyDataObject();</span></font></p><p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp; $c : Cycle();<br></span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">then</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp;
System.err.println("MYOBJECT in system: " + $mo.getID() + " |
" + $mo.getTestFieldData() + " on Cycle " + $c.getCount());</span></font></p> 

 

<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end </span></font><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br>When the iteration is over, you would retract the Cycle object.&nbsp; (Only one Cycle should be in working memory at once, and it's a good idea to have a rule that enforces that invariant.)&nbsp; You should follow this pattern for any rule you want to guarantee to fire on each iteration.<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Chris Richmond &lt;crichmond@referentia.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> Rules Users List &lt;rules-users@lists.jboss.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, September 23, 2009 2:15:35 PM<br><b><span
 style="font-weight: bold;">Subject:</span></b> [rules-users] persistent java objects in working memory<br></font><br>



 
 
<style>
<!--
 
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
span.EmailStyle17
        {font-family:Arial;color:windowtext;}
 _filtered {margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {}
-->
</style>



<div class="Section1">

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hello,</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I am trying to create a set of java objects, which I insert
into the session at startup. &nbsp;Then at regular timed iterations I want to
examine the values of those objects. &nbsp;During the timer iteration, some
fields may have been changed by the primary program. &nbsp;So I have a rule for
now that is just trying to identify that the do indeed exist on each iteration:<br>
<br>
</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> &nbsp;</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">rule "Identify Java
Objects"</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp; lock-on-active</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">when</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp; $<u><font color="black"><span style="color: black;">mo</span></font></u> : MyDataObject();</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">then</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&nbsp;&nbsp;
System.err.println("MYOBJECT in system: " + $mo.getID + " |
" + $mo.getTestFieldData);</span></font></p> 

<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end&nbsp;&nbsp; </span></font></p> 

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">As I said, at startup I insert 3 of these objects into my
session, then every 10 seconds I just want to ensure they are there. &nbsp;However
the output from this rule only fires on the firet iteration, after that the
rule doesn’t fire. &nbsp;I am not retrcating the objects or even
concerning myself with the FactHandle, as I plan to leave them in working
memory and change values on those 3 objects from the main application in each
application loop, then make decisions in the rule engine based on the values of
those 3 objects. &nbsp;&nbsp;However, for now I just nee to find out why the
objects only live for my first loop and call of session.fireAllRules().</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Any ideas or what I am doing wrong?</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> &nbsp;</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Thanks,</span></font></p> 

<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><br>
Chris</span></font></p> 

</div>

</div></div></div><br>

      </body></html>