[rules-users] query in drools expert :: rule language

bobbi_80 guruprasad_bobbi at infosys.com
Mon Dec 26 00:50:24 EST 2011


Hi ,

I want to know if there is any way I can evaluate a string in rule language.
Here is what I am doing 

DroolsTest.java has a class as follows.

DroolsTest.java

	public static class cpuTracker{
		
		private String machinename;
		private String averageCPU;
	}
I want to set a rule in sample.drl such that if the averageCPU is greater
than 80 an action is taken.

Sample.drl
rule "High CPU Usage"
	when
		$cpuUsage : cpuTracker( Integer.parseInt(averageCPU) > 60 )		
	then
		System.out.println("CPU usage is very high!!");
end

The compiler throws the following error " *no viable alternative at
averageCPU for rule High CPu usage*".
I am unable to convert string to int using Inetger.parseInt(). Any idea why
it is throwing me an error and any help with rule language syntax that I can
get online? Can't find all the answers from
http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html_single/index.html

Any help is highly appreciated.

--
View this message in context: http://drools.46999.n3.nabble.com/query-in-drools-expert-rule-language-tp3612345p3612345.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list