aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java
blob: f89b6a7a5820fc79602f6c0c273ad628b33e6672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
    }
}