2 * ===============================LICENSE_START======================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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===========================================
21 package org.openecomp.dcae.apod.analytics.dmaap.service.publisher;
23 import java.util.List;
27 * DMaaP MR Publisher Queue handles back pressure in case DMaaP MR Publisher topic
28 * is offline for some reason. It does so by having a recovery queue which keeps
29 * messages in order in case there is temporary interruption in DMaaP Publisher
32 * @author Rajiv Singla . Creation Date: 11/1/2016.
34 public interface DMaaPMRPublisherQueue {
38 * Add batchMessages to Batch Queue
41 * @param batchMessages messages that needs to be added to batch queue
42 * @return current size of batch queue. Throws {@link IllegalStateException}
43 * if batch queue does not have enough space
45 int addBatchMessages(List<String> batchMessages);
50 * Add recoverable messages to Recoverable Queue
53 * @param recoverableMessages messages that needs to be added to recoverable queue
54 * @return current size of the recoverable queue. Throws {@link IllegalStateException}
55 * if recoverable queue does not have enough space
57 int addRecoverableMessages(List<String> recoverableMessages);
61 * Get messages that need to be published to DMaaP topic. Messages in recoverable
62 * queue are appended if present.
65 * @return List of messages from both batch and recovery queue
67 List<String> getMessageForPublishing();
71 * Remaining capacity of Batch Queue
74 * @return Remaining Batch Queue Size
76 int getBatchQueueRemainingSize();
80 * Remaining capacity of Recovery Queue
83 * @return Remaining Recovery Queue Size
85 int getRecoveryQueueRemainingSize();