A better approach would be to use:-
rule "system will execute 'tc' command"
when
Server(message>8388608)
then
System.out.println("The network is so crowd that it needs repairing.");
Runtime.getRuntime().exec("tc");#execute the "tc" command
end
This assumes you insert Server facts into working memory and they have a
"getMessage" property.
Normally you'd use eval when you are unable to leverage DRL. Their use is
normally discouraged. Also, your usage is incorrect; please read the
documentation.
With kind regards,
Mike
2011/4/12 赵慧 <zhaoh(a)hpnl.ac.cn>
hello,everyone!I wrote a rule with Drools,but the error told me that
the
field Server.Message is not visible, I can't find how it happens. Please
help me, I am almost exhausted with it. thank you.
the rules are as follows:
package com.sample
import com.sample.Server;
rule "system will execute 'tc' command"
when
eval(Server.Message>8388608)
then
System.out.println("The network is so crowd that it needs
repairing.");
Runtime.getRuntime().exec("tc");#execute the "tc" command
end
rule "caution"
when
eval(Server.Message==8388608)
then
System.out.println("caution!The network maybe will get blocked very
soon.");
end
rule "fluent network"
when
eval(Server.Message<8388608)#conditions
then
System.out.println("the current network is very good");#actions
end
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users