From d8542b5a55d19584454215cd22d2f86cfb30e0a6 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 13 May 2020 12:55:37 -0400 Subject: Handle duplicate events in drools-apps Modified the frankfurt rules to compare the event objects instead of comparing the request ID when determining if an event is new. The event object's equals() method ignores the request ID when doing the comparison, thus it will treat an event as a duplicate even if the request ID is different, which is the behavior we want. Also removed the @Ignore from the junit that tests for duplicate events in the hope that this change will fix it. If the docker build still breaks, then @Ignore can be added back in. Issue-ID: POLICY-2557 Change-Id: If2b9fd26473d78a356218b951bfe160f93daeb32 Signed-off-by: Jim Hahn --- .../common/controller-frankfurt/src/main/resources/frankfurt.drl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl') diff --git a/controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl b/controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl index f54786da9..c42131318 100644 --- a/controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl +++ b/controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl @@ -100,7 +100,7 @@ rule "EVENT" $params : ControlLoopParams( $clName : getClosedLoopControlName() ) $event : CanonicalOnset( closedLoopControlName == $clName ) not ( ControlLoopEventManager2( closedLoopControlName == $event.getClosedLoopControlName(), - requestId == $event.getRequestId() ) ) + getContext().getEvent() == $event ) ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -173,7 +173,7 @@ rule "EVENT.MANAGER.NEW.EVENT" when $event : VirtualControlLoopEvent( ) $manager : ControlLoopEventManager2( closedLoopControlName == $event.getClosedLoopControlName(), - requestId == $event.getRequestId() ) + getContext().getEvent() == $event ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -202,6 +202,8 @@ rule "EVENT.MANAGER.NEW.EVENT" // // TODO: handle the abatement. Currently, it's just discarded. // + logger.info("{}: {}.{}: abatement", + $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName()); break; case FIRST_ONSET: -- cgit 1.2.3-korg