rule drl file in drools version 3 is given below, now we are upgrading to drools version 7.69
package rules.event
dialect "java"`
rule "TASK_ARC_CIFF01_XMIT01_EXCEPTION_1000"
when
message : Message( product == "ARC", subtask == "MOVE01" ) ;
then
exception.evaluate("1000",message);
mq.notify(exception,message);end
//VMS message translation rules
rule "VMS_TRANSLATION"
when
message :
Message(( product == "ISIXSR", subtask == "BLDPZ1" ) ||
Message( product == "ISIXSR", subtask == "ECPLD2" ) ||
Message( product == "ISIXSL", subtask == "FILMV1" ) ||
Message( product == "ISIXSL", subtask == "MOVE01" ) ||
Message( product == "ISIXRL", subtask == "MOVE01" ) ||
Message( product == "ISIXRR", subtask == "MOVE01" ) ||
Message( product == "ISIXER", subtask == "VALID2" ) ||
Message( product == "ISIXRR", subtask == "XRFMV1" ) )
then
vmstr.notify(message);
end
Error: Above file gives error message
Drools Error- ERR 102 mismatched input ',' in drools rule at line
rule "VMS_TRANSLATION"
when
message : Message(( product == "ISIXSR", subtask == "BLDPZ1" ) ||
Can you please suggest what changes needed according to drools version 7
Migrating drools 3 rule engine to drools 7.69 rule engine.
If you really want to use that rule, you need to use &&
and not ,
for those conditions.
Eg.
Message( (product == "ISIXSR" && subtask == "BLDPZ1") || ...
That being said, whenever you find yourself writing "or" conditions in rules, it's a sure-fire sign that you should have 2 (or more) rules.
I would rewrite "VMS_TRANSLATION" like this:
rule "VMS_TRANSLATION - ISIXSR"
when
message: Message( product == "ISIXSR", subtask in ("BLDPZ1", "ECPLD2"))
then
vmstr.notify(message)
end
rule "VMS_TRANSLATION - ISIXSL"
when
message: Message( product == "ISIXSL", subtask in ("FILMV1", "MOVE01"))
then
vmstr.notify(message)
end
rule "VMS_TRANSLATION - ISIXRL"
when
message: Message( product == "ISIXRL", subtask == "MOVE01" )
then
vmstr.notify(message)
end
rule "VMS_TRANSLATION - ISIXRR"
when
message: Message( product == "ISIXRR", subtask in ("MOVE01", "XRFMV1") )
then
vmstr.notify(message)
end
rule "VMS_TRANSLATION - ISIXER"
when
message: Message( product == "ISIXER", subtask == "VALID2" )
then
vmstr.notify(message)
end
It's a lot clearer, and a lot easier to test this way too.