Did you try using:
Hello everybody,
*I need help please **I am new in drools, to start I am trying to
write some simple examples with drools fusion . I wrote a rule which
print a message when an alarm is received multiple times during 20
minutes but i get this error
*
[java] Unable to create Field Extractor for 'BtsNumber' of
'[ClassObjectType event=com.mfe.casestudy.pojo.AlarmFailureEvent]' in
rule 'MaxBtsAlarmrule' : [Rule name='MaxBtsAlarmrule']
[java] java.lang.IllegalArgumentException: Could not parse knowledge.
[java] at
com.mfe.casestudy.test.Tester.prepareKnowledgeBase(Tester.java:73)
[java] at com.mfe.casestudy.test.Tester.setUp(Tester.java:43)
[java] at com.mfe.casestudy.test.Tester.main(Tester.java:87)
[java] Exception in thread "main" java.lang.NullPointerException
[java] at
com.mfe.casestudy.test.Tester.prepareStatefulKnowledgeSession(Tester.java:58)
[java] at com.mfe.casestudy.test.Tester.setUp(Tester.java:44)
[java] at com.mfe.casestudy.test.Tester.main(Tester.java:87)
[java] Java Result: 1
main:
*This is my rule it calculates the number of alarms received from one
BTS and if this number exceeds the threshold it prints a warning message *
rule "MaxBtsAlarmrule"
dialect "mvel"
no-loop true
salience 100
when
$BTS : BTS()
# check if the number of alarms of last 20 minutes exceeds
# the BTS threshold
$numOfAlarms : Number( intValue > $BTS.threshold )
from accumulate(
AlarmFailureEvent(
BtsNumber == $BTS.number,
$ID : ID
)
over window:time(3) from
entry-point BTSAlarmStream,
count($ID)
)
then
System.out.println("BTS should be restarted...");
end
Finally this is the alarm event class
public class AlarmFailureEvent implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public String BtsNumber = "";
private int code = 0;
private int ID=0;
public AlarmFailureEvent(String BtsNumber, int code ,int ID) {
this.BtsNumber = BtsNumber;
this.ID=ID;
this.code=code;
}
public void setID(int iD) {
this.ID = iD;
}
public int getID() {
return this.ID;
}
public void setCode(int code) {
this.code = code;
}
public int getCode() {
return this.code;
}
public void setBtsNumber(String btsNumber) {
this.BtsNumber = btsNumber;
}
public String getBtsNumber() {
return BtsNumber;
}
}
*Thank you *
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users