454f384ae524d73c8689e3d673540fc50d54c232
[dcaegen2/analytics/tca.git] / dcae-analytics-cdap-plugins / src / main / java / org / openecomp / dcae / apod / analytics / cdap / plugins / domain / config / dmaap / DMaaPMRSinkPluginConfig.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\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
10  *\r
11  *          http://www.apache.org/licenses/LICENSE-2.0\r
12  *\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
19  */\r
20 \r
21 package org.openecomp.dcae.apod.analytics.cdap.plugins.domain.config.dmaap;\r
22 \r
23 import co.cask.cdap.api.annotation.Description;\r
24 import co.cask.cdap.api.annotation.Macro;\r
25 import com.google.common.base.Objects;\r
26 \r
27 import javax.annotation.Nullable;\r
28 \r
29 /**\r
30  * DMaaP MR Publisher Config\r
31  * <p>\r
32  * @author Rajiv Singla . Creation Date: 1/17/2017.\r
33  */\r
34 public class DMaaPMRSinkPluginConfig extends BaseDMaaPMRPluginConfig {\r
35 \r
36     private static final long serialVersionUID = 1L;\r
37 \r
38     @Description("Column name of input schema which contains the message that needs to be written to DMaaP MR Topic")\r
39     @Macro\r
40     protected String messageColumnName;\r
41 \r
42     @Description("DMaaP MR Publisher Max Batch Size. Defaults to no Batch")\r
43     @Nullable\r
44     @Macro\r
45     protected Integer maxBatchSize;\r
46 \r
47     @Description("DMaaP MR Publisher Recovery Queue Size. Default to 1000K messages which can be buffered in memory " +\r
48             "in case DMaaP MR Publisher is temporarily unavailable")\r
49     @Nullable\r
50     @Macro\r
51     protected Integer maxRecoveryQueueSize;\r
52 \r
53     // Required No Arg constructor\r
54     public DMaaPMRSinkPluginConfig() {\r
55         this(null, null, null, null);\r
56     }\r
57 \r
58     public DMaaPMRSinkPluginConfig(String referenceName, String hostName, String topicName, String messageColumnName) {\r
59         super(referenceName, hostName, topicName);\r
60         this.messageColumnName = messageColumnName;\r
61     }\r
62 \r
63     /**\r
64      * Column name of incoming Schema field that contains the message that needs to published to DMaaP MR Topic\r
65      *\r
66      * @return Column name of incoming schema which contains message that needs to published to DMaaP MR Topic\r
67      */\r
68     public String getMessageColumnName() {\r
69         return messageColumnName;\r
70     }\r
71 \r
72     /**\r
73      * DMaaP MR Publisher Max Batch Size.\r
74      *\r
75      * @return DMaaP MR Publisher Max Batch Size\r
76      */\r
77     @Nullable\r
78     public Integer getMaxBatchSize() {\r
79         return maxBatchSize;\r
80     }\r
81 \r
82     /**\r
83      * DMaaP MR Publisher Max Recovery Queue Size\r
84      *\r
85      * @return DMaaP MR Publisher Max Recovery Queue Size\r
86      */\r
87     @Nullable\r
88     public Integer getMaxRecoveryQueueSize() {\r
89         return maxRecoveryQueueSize;\r
90     }\r
91 \r
92     @Override\r
93     public String toString() {\r
94         return Objects.toStringHelper(this)\r
95                 .add("super", super.toString())\r
96                 .add("messageColumnName", messageColumnName)\r
97                 .add("maxBatchSize", maxBatchSize)\r
98                 .add("maxRecoveryQueueSize", maxRecoveryQueueSize)\r
99                 .toString();\r
100     }\r
101 }\r