[rules-users] How does 'from' cache works?

Esteban Aliverti esteban.aliverti at gmail.com
Wed Sep 12 11:56:48 EDT 2012


Assuming I have the following rule:

global SomeClient client;

rule "Poll Values"
timer (int: 0s 1s)
when
    $data: Data() from client.getData();
then
    insert($data);
end

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.

My questions are:
1.- How many times is the rule going to be executed?
2.- How many times is  client.getData() going to be invoked?

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?
As the rule name states, I'm expecting to get some (different) values from
client every second.
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.

Best Regards,


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120912/87598c09/attachment.html 


More information about the rules-users mailing list