我遇到了多个规则匹配并获得具有最低显着性的规则的问题。这是源文件。
package HotelAnalyticsLuxuryPromotions
#generated from Decision Table
import com.mmt.analytics.hotel.promotions.drools.HotelPromotionsDroolsPojo;
import com.mmt.analytics.hotel.promotions.drools.HotelPromotionsDroolRules;
#From row number: 11
rule "for Luxury Hotel Promotions_11"
salience 9
when
fact: HotelPromotionsDroolsPojo(
eval(HotelPromotionsDroolRules.checkHotelId(fact,"12345")),
eval(HotelPromotionsDroolRules.checkRsq(fact,"*")),
eval(HotelPromotionsDroolRules.checkValidCheckInCheckOut(fact,"*")),
eval(HotelPromotionsDroolRules.checkLoggedStatus(fact,"*")))
eval(HotelPromotionsDroolRules.checkActiveStatus(fact,"1"))
then
fact.setPackageName("Pack 2");
fact.setRatePlanCode("ABC 2");
fact.setTariffUrl("TariffUrl");
fact.setClickUrl("ClickUrl");
fact.setInclusionText("InclusionText");
end
#From row number: 12
rule "for Luxury Hotel Promotions_12"
salience 10
when
fact: HotelPromotionsDroolsPojo(
eval(HotelPromotionsDroolRules.checkHotelId(fact,"12345")),
eval(HotelPromotionsDroolRules.checkRsq(fact,"*")),
eval(HotelPromotionsDroolRules.checkValidCheckInCheckOut(fact,"*")),
eval(HotelPromotionsDroolRules.checkLoggedStatus(fact,"*")))
eval(HotelPromotionsDroolRules.checkActiveStatus(fact,"1"))
then
fact.setPackageName("Pack 1");
fact.setRatePlanCode("ABC 1");
fact.setTariffUrl("TariffUrl");
fact.setClickUrl("ClickUrl");
fact.setInclusionText("InclusionText");
end
#From row number: 14
rule "for Luxury Hotel Promotions_14"
salience 5
when
fact:HotelPromotionsDroolsPojo(
eval(HotelPromotionsDroolRules.checkHotelId(fact,"12345")),
eval(HotelPromotionsDroolRules.checkRsq(fact,"*")),
eval(HotelPromotionsDroolRules.checkValidCheckInCheckOut(fact,"*")),
eval(HotelPromotionsDroolRules.checkLoggedStatus(fact,"*")))
eval(HotelPromotionsDroolRules.checkActiveStatus(fact,"1"))
then
fact.setPackageName("Pack 3");
fact.setRatePlanCode("ABC 3");
fact.setTariffUrl("TariffUrl");
fact.setClickUrl("ClickUrl");
fact.setInclusionText("InclusionText");
end
我认为必须返回具有最高优先级的规则,但我得到了相反的结果。
下面是规则引擎的代码
StatelessKnowledgeSession kSession = promotionsDroolManager.getStatelessSession();
kSession.execute(droolsPojo);
我正在使用这些 Drool 配置属性
promotions.drools.agent.scan.resources=true
promotions.drools.agent.scan.directories=true
promotions.drools.resource.scanner.interval=1800
promotions.drools.agent.monitor.change.set.events=true
promotions.drools.knowledge.agent.name=Promotions_Knowledge_agent
promotions.drools.base.knowledge.agent.change.set.path=promotions.xml
请。建议