A better approach would be to use:-<br><br><div style="font-family: courier new,monospace;">rule "system will execute 'tc' command"<br> when<br> Server(message>8388608)<br> then <br> System.out.println("The network is so crowd that it needs repairing.");<br>
Runtime.getRuntime().exec("tc");#execute the "tc" command<br>end</div>
<br>This assumes you insert Server facts into working memory and they have a "getMessage" property.<br><br>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.<br>
<br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">2011/4/12 ÕÔ»Û <span dir="ltr"><<a href="mailto:zhaoh@hpnl.ac.cn">zhaoh@hpnl.ac.cn</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
<div>
<div>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.</div>
<div>the rules are as follows:</div>
<div> </div>
<div>package com.sample</div>
<div>import com.sample.Server;</div>
<div> </div>
<div>rule "system will execute 'tc' command"<br> when<br> eval(Server.Message>8388608)<br> then <br> System.out.println("The network is so crowd that it needs repairing.");<br> Runtime.getRuntime().exec("tc");#execute the "tc" command<br>
end</div>
<div> </div>
<div>rule "caution"<br> when <br> eval(Server.Message==8388608)<br> then <br> System.out.println("caution!The network maybe will get blocked very soon.");<br>end </div>
<div> </div>
<div>rule "fluent network"<br> when<br> eval(Server.Message<8388608)#conditions<br> then <br> System.out.println("the current network is very good");#actions<br>end</div></div><br></div> <br><br>
<br><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>