Assuming I have the following rule:<div><br></div><div><div>global SomeClient client;</div><div><br></div><div>rule "Poll Values"</div><div>timer (int: 0s 1s)</div><div>when</div><div> $data: Data() from client.getData();</div>
<div>then</div><div> insert($data);</div><div>end</div></div><div><br></div><div>and that I'm just creating a session with just that rule, setting the global and calling fireAllRules(). And let's say that my session is running for 5 seconds.</div>
<div><br></div><div>My questions are:</div><div>1.- How many times is the rule going to be executed?</div><div>2.- How many times is client.getData() going to be invoked? </div><div><br></div><div>The test I have shows that the rule is executed 5 times, but client.getData() is only invoked for the first activation. The returned object is used in the subsequent activations. Is this the expected behavior?</div>
<div>As the rule name states, I'm expecting to get some (different) values from client every second. </div><div>I understand that I'm doing 'strange' things since the rule doesn't use any real fact but I would like to understand why I'm experiencing the described behavior. </div>
<div><br></div><div>Best Regards,</div><div><br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
</div>