summaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases/src/main/resources/usecases.drl
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/controller-usecases/src/main/resources/usecases.drl')
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl26
1 files changed, 25 insertions, 1 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index 49ab78d71..5074215bb 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -45,6 +45,7 @@ import org.onap.policy.drools.apps.controller.usecases.UsecasesEventManager;
import org.onap.policy.controlloop.eventmanager.ClEventManagerWithSteps.State;
import org.onap.policy.controlloop.eventmanager.ClEventManagerWithOutcome.OperationOutcome2;
import org.onap.policy.controlloop.eventmanager.ClEventManagerWithEvent.NewEventStatus;
+import org.onap.policy.controlloop.eventmanager.EventManagerServices;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.slf4j.LoggerFactory;
@@ -52,6 +53,27 @@ import org.slf4j.Logger;
import org.onap.policy.drools.system.PolicyEngineConstants;
+
+/*
+* Called at initial start-up, to create the event services that will be used by all
+* event managers in this rule engine instance.
+*/
+rule "CREATE.EVENT.SERVICES"
+ when
+ not (EventManagerServices())
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}", drools.getRule().getName());
+
+ try {
+ insert(new EventManagerServices("event-manager"));
+
+ } catch(RuntimeException e) {
+ logger.warn("{}: cannot create event services", drools.getRule().getName(), e);
+ }
+end
+
/*
*
* Called when the ControlLoopParams object has been inserted into working memory from the PAP.
@@ -114,6 +136,7 @@ rule "EVENT"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
$event : CanonicalOnset( closedLoopControlName == $clName )
+ $services : EventManagerServices()
not ( UsecasesEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
getEvent() == $event ) )
then
@@ -144,7 +167,8 @@ rule "EVENT"
notification.setPolicyVersion($params.getPolicyVersion());
} else {
- UsecasesEventManager manager = new UsecasesEventManager($params, $event, drools.getWorkingMemory());
+ UsecasesEventManager manager =
+ new UsecasesEventManager($services, $params, $event, drools.getWorkingMemory());
insert(manager);
try {
// load the first policy/step