1 /*******************************************************************************
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
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ============LICENSE_END=========================================================
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 *******************************************************************************/
22 package org.onap.dmaap.dmf.mr.metrics.publisher;
24 import java.io.IOException;
25 import java.util.Collection;
28 * A Cambria publishing interface.
33 public interface CambriaPublisher extends CambriaClient {
35 * A simple message container
37 public static class message {
43 public message(String partition, String msg) {
44 fPartition = partition == null ? "" : partition;
47 throw new IllegalArgumentException("Can't send a null message.");
55 public message(message msg) {
56 this(msg.fPartition, msg.fMsg);
60 * declaring partition string
62 public final String fPartition;
64 * declaring fMsg String
66 public final String fMsg;
70 * Send the given message using the given partition.
74 * @return the number of pending messages
77 int send(String partition, String msg) throws IOException;
80 * Send the given message using its partition.
83 * @return the number of pending messages
86 int send(message msg) throws IOException;
89 * Send the given messages using their partitions.
92 * @return the number of pending messages
95 int send(Collection<message> msgs) throws IOException;
98 * Close this publisher. It's an error to call send() after close()