From ce984167cd55716c8a40324c7f079ed39f5fbfd7 Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta Date: Fri, 16 Mar 2018 14:42:35 +0100 Subject: pnf ready event consumer Change-Id: I63802ea60d318626ae32e734167d2bce602d72e4 Issue-ID: SO-466 Signed-off-by: Lukasz Muszkieta --- .../scripts/PnfReadyEventHandler.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java (limited to 'bpmn') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java new file mode 100644 index 0000000000..f89b6a7a58 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java @@ -0,0 +1,28 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.client.dmaap.DmaapConsumer; +import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer; + +public class PnfReadyEventHandler { + + private ExceptionUtil exceptionUtil; + + private static final String TOPIC_NAME = "VES event"; + + public PnfReadyEventHandler() { + exceptionUtil = new ExceptionUtil(); + } + + public void getPnfReadyEventFromDmaap (DelegateExecution execution) throws Exception { + Object correlationIdVar = execution.getVariable("correlationId"); + if (!(correlationIdVar instanceof String)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "correlationId variable is not String type"); + } + String correlationId = (String) correlationIdVar; + DmaapConsumer dmaapConsumer = new PnfReadyEventConsumer(correlationId); + dmaapConsumer.consume(); + // TODO inform camunda process that event has been received + } +} -- cgit 1.2.3-korg