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 com.att.nsa.mr.client;
24 import java.io.IOException;
25 import java.util.Collection;
28 * A MR publishing interface.
31 public interface MRPublisher extends MRClient
34 * A simple message container
36 public static class message
38 public message ( String partition, String msg )
40 fPartition = partition == null ? "" : partition;
44 throw new IllegalArgumentException ( "Can't send a null message." );
48 public message ( message msg )
50 this ( msg.fPartition, msg.fMsg );
53 public final String fPartition;
54 public final String fMsg;
58 * Send the given message without partition. partition will be placed at HTTP request level.
59 * @param msg message to sent
60 * @return the number of pending messages
61 * @throws IOException exception
63 int send ( String msg ) throws IOException;
65 * Send the given message using the given partition.
66 * @param partition partition
68 * @return the number of pending messages
69 * @throws IOException exception
71 int send ( String partition, String msg ) throws IOException;
74 * Send the given message using its partition.
76 * @return the number of pending messages
77 * @throws IOException exp
79 int send ( message msg ) throws IOException;
82 * Send the given messages using their partitions.
84 * @return the number of pending messages
85 * @throws IOException exp
87 int send ( Collection<message> msgs ) throws IOException;
90 * Close this publisher. It's an error to call send() after close()