Sonar Critical Fix
[dcaegen2/analytics/tca.git] / dcae-analytics-dmaap / src / main / java / org / openecomp / dcae / apod / analytics / dmaap / service / publisher / DMaaPMRPublisherQueue.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.dmaap.service.publisher;\r
22 \r
23 import java.util.List;\r
24 \r
25 /**\r
26  * <p>\r
27  *     DMaaP MR Publisher Queue handles back pressure in case DMaaP MR Publisher topic\r
28  *     is offline for some reason. It does so by having a recovery queue which keeps\r
29  *     messages in order in case there is temporary interruption in DMaaP Publisher\r
30  * </p>\r
31  *\r
32  * @author Rajiv Singla . Creation Date: 11/1/2016.\r
33  */\r
34 public interface DMaaPMRPublisherQueue {\r
35 \r
36     /**\r
37      * <p>\r
38      *     Add batchMessages to Batch Queue\r
39      * </p>\r
40      *\r
41      * @param batchMessages messages that needs to be added to batch queue\r
42      * @return current size of batch queue. Throws {@link IllegalStateException}\r
43      * if batch queue does not have enough space\r
44      */\r
45     int addBatchMessages(List<String> batchMessages);\r
46 \r
47 \r
48     /**\r
49      * <p>\r
50      *     Add recoverable messages to Recoverable Queue\r
51      * </p>\r
52      *\r
53      * @param recoverableMessages messages that needs to be added to recoverable queue\r
54      * @return current size of the recoverable queue. Throws {@link IllegalStateException}\r
55      * if recoverable queue does not have enough space\r
56      */\r
57     int addRecoverableMessages(List<String> recoverableMessages);\r
58 \r
59     /**\r
60      * <p>\r
61      *     Get messages that need to be published to DMaaP topic. Messages in recoverable\r
62      *     queue are appended if present.\r
63      * </p>\r
64      *\r
65      * @return List of messages from both batch and recovery queue\r
66      */\r
67     List<String> getMessageForPublishing();\r
68 \r
69     /**\r
70      * <p>\r
71      *     Remaining capacity of Batch Queue\r
72      * </p>\r
73      *\r
74      * @return Remaining Batch Queue Size\r
75      */\r
76     int getBatchQueueRemainingSize();\r
77 \r
78     /**\r
79      * <p>\r
80      *     Remaining capacity of Recovery Queue\r
81      * </p>\r
82      *\r
83      * @return Remaining Recovery Queue Size\r
84      */\r
85     int getRecoveryQueueRemainingSize();\r
86 \r
87 }\r