2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.cdap.tca.flow;
\r
23 import co.cask.cdap.api.flow.AbstractFlow;
\r
24 import org.openecomp.dcae.apod.analytics.cdap.common.CDAPComponentsConstants;
\r
25 import org.openecomp.dcae.apod.analytics.cdap.tca.flowlet.TCAVESAAIEnrichmentFlowlet;
\r
26 import org.openecomp.dcae.apod.analytics.cdap.tca.flowlet.TCAVESAlertsAbatementFlowlet;
\r
27 import org.openecomp.dcae.apod.analytics.cdap.tca.flowlet.TCAVESAlertsSinkFlowlet;
\r
28 import org.openecomp.dcae.apod.analytics.cdap.tca.flowlet.TCAVESMessageRouterFlowlet;
\r
29 import org.openecomp.dcae.apod.analytics.cdap.tca.flowlet.TCAVESThresholdViolationCalculatorFlowlet;
\r
30 import org.openecomp.dcae.apod.analytics.cdap.tca.settings.TCAAppConfig;
\r
33 * TCA Flow for VES (Virtual Event Streaming) Collector Flow
\r
35 * @author Rajiv Singla . Creation Date: 11/3/2016.
\r
37 public class TCAVESCollectorFlow extends AbstractFlow {
\r
39 private final TCAAppConfig tcaAppConfig;
\r
41 public TCAVESCollectorFlow(TCAAppConfig tcaAppConfig) {
\r
42 this.tcaAppConfig = tcaAppConfig;
\r
46 protected void configure() {
\r
48 setName(CDAPComponentsConstants.TCA_FIXED_VES_COLLECTOR_NAME_FLOW);
\r
49 setDescription(CDAPComponentsConstants.TCA_FIXED_VES_COLLECTOR_DESCRIPTION_FLOW);
\r
51 final TCAVESMessageRouterFlowlet messageRouterFlowlet = new TCAVESMessageRouterFlowlet();
\r
52 addFlowlet(messageRouterFlowlet);
\r
54 final TCAVESThresholdViolationCalculatorFlowlet thresholdViolationCalculatorFlowlet =
\r
55 new TCAVESThresholdViolationCalculatorFlowlet(tcaAppConfig.getTcaVESMessageStatusTableName());
\r
56 addFlowlet(thresholdViolationCalculatorFlowlet, tcaAppConfig.getThresholdCalculatorFlowletInstances());
\r
58 final TCAVESAlertsAbatementFlowlet tcavesAlertsAbatementFlowlet =
\r
59 new TCAVESAlertsAbatementFlowlet(tcaAppConfig.getTcaAlertsAbatementTableName());
\r
60 addFlowlet(tcavesAlertsAbatementFlowlet);
\r
62 final TCAVESAAIEnrichmentFlowlet tcavesaaiEnrichmentFlowlet = new TCAVESAAIEnrichmentFlowlet();
\r
63 addFlowlet(tcavesaaiEnrichmentFlowlet);
\r
65 final TCAVESAlertsSinkFlowlet alertsSinkFlowlet =
\r
66 new TCAVESAlertsSinkFlowlet(tcaAppConfig.getTcaVESAlertsTableName());
\r
67 addFlowlet(alertsSinkFlowlet);
\r
70 // connect DMaaP MR VES Subscriber output stream to VES Message Router Flowlet
\r
71 connectStream(tcaAppConfig.getTcaSubscriberOutputStreamName(), messageRouterFlowlet);
\r
72 // connect message router to VES threshold calculator
\r
73 connect(messageRouterFlowlet, thresholdViolationCalculatorFlowlet);
\r
74 // connect VES threshold calculator flowlet to Alerts Abatement Flowlet
\r
75 connect(thresholdViolationCalculatorFlowlet, tcavesAlertsAbatementFlowlet);
\r
76 // connect Alerts Abatement flowlet to AAI Enrichment Flowlet
\r
77 connect(tcavesAlertsAbatementFlowlet, tcavesaaiEnrichmentFlowlet);
\r
78 // connect A&AI Enrichment flowlet to Alerts Sink Flowlet
\r
79 connect(tcavesaaiEnrichmentFlowlet, alertsSinkFlowlet);
\r