diff options
author | biniek <lukasz.biniek@nokia.com> | 2018-04-10 10:48:54 +0200 |
---|---|---|
committer | biniek <lukasz.biniek@nokia.com> | 2018-04-10 11:39:12 +0200 |
commit | 402e5e2cad8320dcfe7bd49cc9724d3071a4224d (patch) | |
tree | 2d8f9cbe47251555f938adf93511ba28fc8d91f1 /bpmn/MSOInfrastructureBPMN/src/main/java | |
parent | f115334f0e8711e36dd43bc79335f2c98c77723f (diff) |
Added informing dmaap client in pnf-ready workflow
Change-Id: I0d7b610e24da56aad32a9b02b987f98f932456f6
Issue-ID: SO-506
Signed-off-by: biniek <lukasz.biniek@nokia.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/java')
2 files changed, 71 insertions, 0 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java new file mode 100644 index 0000000000..5a8d741a05 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.pnf.delegate; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient; +import org.springframework.beans.factory.annotation.Autowired; + +public class InformDmaapClient implements JavaDelegate { + + private DmaapClient dmaapClient; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService() + .createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(execution.getProcessBusinessKey()) + .correlateWithResult()); + } + + @Autowired + public void setDmaapClient(DmaapClient dmaapClient) { + this.dmaapClient = dmaapClient; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java new file mode 100644 index 0000000000..07e8ada21e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.pnf.implementation; + +public interface DmaapClient { + + void registerForUpdate(String correlationId, Runnable informConsumer); +} |