Initial TCA commit into DCAEGEN2
[dcaegen2/analytics/tca.git] / dcae-analytics-cdap-plugins / src / main / java / org / openecomp / dcae / apod / analytics / cdap / plugins / domain / config / dmaap / DMaaPMRSinkPluginConfig.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
4  * ================================================================================
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *   You may obtain a copy of the License at
10  *
11  *          http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *  Unless required by applicable law or agreed to in writing, software
14  *  distributed under the License is distributed on an "AS IS" BASIS,
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *  See the License for the specific language governing permissions and
17  *  limitations under the License.
18  *  ============================LICENSE_END===========================================
19  */
20
21 package org.openecomp.dcae.apod.analytics.cdap.plugins.domain.config.dmaap;
22
23 import co.cask.cdap.api.annotation.Description;
24 import co.cask.cdap.api.annotation.Macro;
25 import com.google.common.base.Objects;
26
27 import javax.annotation.Nullable;
28
29 /**
30  * DMaaP MR Publisher Config
31  * <p>
32  * @author Rajiv Singla . Creation Date: 1/17/2017.
33  */
34 public class DMaaPMRSinkPluginConfig extends BaseDMaaPMRPluginConfig {
35
36     private static final long serialVersionUID = 1L;
37
38     @Description("Column name of input schema which contains the message that needs to be written to DMaaP MR Topic")
39     @Macro
40     protected String messageColumnName;
41
42     @Description("DMaaP MR Publisher Max Batch Size. Defaults to no Batch")
43     @Nullable
44     @Macro
45     protected Integer maxBatchSize;
46
47     @Description("DMaaP MR Publisher Recovery Queue Size. Default to 1000K messages which can be buffered in memory " +
48             "in case DMaaP MR Publisher is temporarily unavailable")
49     @Nullable
50     @Macro
51     protected Integer maxRecoveryQueueSize;
52
53     // Required No Arg constructor
54     public DMaaPMRSinkPluginConfig() {
55         this(null, null, null, null);
56     }
57
58     public DMaaPMRSinkPluginConfig(String referenceName, String hostName, String topicName, String messageColumnName) {
59         super(referenceName, hostName, topicName);
60         this.messageColumnName = messageColumnName;
61     }
62
63     /**
64      * Column name of incoming Schema field that contains the message that needs to published to DMaaP MR Topic
65      *
66      * @return Column name of incoming schema which contains message that needs to published to DMaaP MR Topic
67      */
68     public String getMessageColumnName() {
69         return messageColumnName;
70     }
71
72     /**
73      * DMaaP MR Publisher Max Batch Size.
74      *
75      * @return DMaaP MR Publisher Max Batch Size
76      */
77     @Nullable
78     public Integer getMaxBatchSize() {
79         return maxBatchSize;
80     }
81
82     /**
83      * DMaaP MR Publisher Max Recovery Queue Size
84      *
85      * @return DMaaP MR Publisher Max Recovery Queue Size
86      */
87     @Nullable
88     public Integer getMaxRecoveryQueueSize() {
89         return maxRecoveryQueueSize;
90     }
91
92     @Override
93     public String toString() {
94         return Objects.toStringHelper(this)
95                 .add("super", super.toString())
96                 .add("messageColumnName", messageColumnName)
97                 .add("maxBatchSize", maxBatchSize)
98                 .add("maxRecoveryQueueSize", maxRecoveryQueueSize)
99                 .toString();
100     }
101 }