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.flowlet;
\r
23 import co.cask.cdap.api.annotation.Output;
\r
24 import co.cask.cdap.api.annotation.ProcessInput;
\r
25 import co.cask.cdap.api.flow.flowlet.AbstractFlowlet;
\r
26 import co.cask.cdap.api.flow.flowlet.OutputEmitter;
\r
27 import co.cask.cdap.api.flow.flowlet.StreamEvent;
\r
28 import com.google.common.base.Charsets;
\r
29 import org.openecomp.dcae.apod.analytics.cdap.common.CDAPComponentsConstants;
\r
30 import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants;
\r
34 * TCA Message Router Flowlet emits VES Message to {@link TCAVESThresholdViolationCalculatorFlowlet} instances
\r
36 * @author Rajiv Singla . Creation Date: 11/14/2016.
\r
38 public class TCAVESMessageRouterFlowlet extends AbstractFlowlet {
\r
41 * Emits ves message to TCA Calculator Instances
\r
43 @Output(CDAPComponentsConstants.TCA_FIXED_VES_MESSAGE_ROUTER_OUTPUT)
\r
44 protected OutputEmitter<String> vesMessageEmitter;
\r
48 public void configure() {
\r
49 setName(CDAPComponentsConstants.TCA_FIXED_VES_MESSAGE_ROUTER_NAME_FLOWLET);
\r
50 setDescription(CDAPComponentsConstants.TCA_FIXED_VES_MESSAGE_ROUTER_DESCRIPTION_FLOWLET);
\r
54 public void routeVESMessage(StreamEvent vesMessageStreamEvent) {
\r
55 final String vesMessage = Charsets.UTF_8.decode(vesMessageStreamEvent.getBody()).toString();
\r
56 vesMessageEmitter.emit(
\r
57 vesMessage, AnalyticsConstants.TCA_VES_MESSAGE_ROUTER_PARTITION_KEY, vesMessage.hashCode());
\r