Insert subprcess to delete E2E service instance
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / infrastructure / scripts / PnfReadyEventHandler.java
1 package org.openecomp.mso.bpmn.infrastructure.scripts;
2
3 import org.camunda.bpm.engine.delegate.DelegateExecution;
4 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
5 import org.openecomp.mso.client.dmaap.DmaapConsumer;
6 import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer;
7
8 public class PnfReadyEventHandler {
9
10     private ExceptionUtil exceptionUtil;
11
12     private static final String TOPIC_NAME = "VES event";
13
14     public PnfReadyEventHandler() {
15         exceptionUtil = new ExceptionUtil();
16     }
17
18     public void getPnfReadyEventFromDmaap (DelegateExecution execution) throws Exception {
19         Object correlationIdVar = execution.getVariable("correlationId");
20         if (!(correlationIdVar instanceof String)) {
21             exceptionUtil.buildAndThrowWorkflowException(execution, 500, "correlationId variable is not String type");
22         }
23         String correlationId = (String) correlationIdVar;
24         DmaapConsumer dmaapConsumer = new PnfReadyEventConsumer(correlationId);
25         dmaapConsumer.consume();
26         // TODO inform camunda process that event has been received
27     }
28 }