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.dmaap.service.publisher;
\r
23 import org.openecomp.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeException;
\r
24 import org.openecomp.dcae.apod.analytics.dmaap.domain.config.DMaaPMRPublisherConfig;
\r
25 import org.openecomp.dcae.apod.analytics.dmaap.domain.response.DMaaPMRPublisherResponse;
\r
27 import java.util.Date;
\r
28 import java.util.List;
\r
32 * DMaaP MR Publisher can be used to publish messages to DMaaP MR Topics.
\r
35 * @author Rajiv Singla . Creation Date: 10/13/2016.
\r
37 public interface DMaaPMRPublisher extends AutoCloseable {
\r
42 * Adds collection of messages to DMaaP MR Topic Publishing Queue.
\r
44 * Note: Invoking this method may or may not cause publishing immediately
\r
45 * as publishing in done is batch mode by default. Parameter maxBatchSize
\r
46 * in {@link DMaaPMRPublisherConfig} is used to determine max batch queue size.
\r
47 * If the maxBatchSize is reached all message will be published automatically
\r
48 * during subsequent call.
\r
51 * @param messages messages to publish to DMaaP MR Publisher
\r
52 * @return response which may contain Http Response code 202 (Accepted) as publishing
\r
53 * will proceed when max batch size is reached. Throws {@link DCAEAnalyticsRuntimeException}
\r
54 * if publishing fails
\r
56 DMaaPMRPublisherResponse publish(List<String> messages);
\r
61 * Forces publishing of messages to DMaaP MR Topic and returns {@link DMaaPMRPublisherResponse}
\r
62 * which can be inspected for HTTP status code of publishing call to DMaaP MR Topic.
\r
65 * @param messages messages to publish to DMaaP MR Publisher
\r
66 * @return DMaaP Message Router Publisher Response. Throws {@link DCAEAnalyticsRuntimeException}
\r
67 * if force publishing fails
\r
70 DMaaPMRPublisherResponse forcePublish(List<String> messages);
\r
75 * Forces publishing of messages in Publisher queue to DMaaP MR Topic and returns
\r
76 * {@link DMaaPMRPublisherResponse}.If there are no messages were in the queue to
\r
77 * be flushed response code 304 (Not Modified) will be returned
\r
80 * @return DMaaP Message Router Publisher Response
\r
82 DMaaPMRPublisherResponse flush();
\r
87 * Returns the creation time when Publisher instance was created.
\r
90 * @return creation time of Subscriber instance
\r
92 Date getPublisherCreationTime();
\r