blob: 6156134e49b1078ab5f2ffc6ca3ce6c4cc20b674 [file] [log] [blame]
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -07001/**
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -070016package org.onosproject.kafkaintegration.api;
17
Shravan Ambati4c6295e2016-12-20 14:53:06 -080018import java.util.concurrent.Future;
Yuta HIGUCHI9efba1e2016-07-09 11:07:13 -070019
Shravan Ambati4c6295e2016-12-20 14:53:06 -080020import org.onosproject.kafkaintegration.api.dto.KafkaServerConfig;
21import org.apache.kafka.clients.producer.ProducerRecord;
22import org.apache.kafka.clients.producer.RecordMetadata;
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -070023/**
Shravan Ambati4c6295e2016-12-20 14:53:06 -080024 * APIs for controlling the Kafka Producer.
25 *
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -070026 */
27public interface KafkaPublisherService {
28
29 /**
Shravan Ambati4c6295e2016-12-20 14:53:06 -080030 * Starts the Kafka Producer.
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -070031 *
Shravan Ambati4c6295e2016-12-20 14:53:06 -080032 * @param config the Kafka Server Config
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -070033 */
Shravan Ambati4c6295e2016-12-20 14:53:06 -080034 void start(KafkaServerConfig config);
35
36 /**
37 * Stops the Kafka Producer.
38 *
39 */
40 void stop();
41
42 /**
43 * Restarts the Kafka Producer.
44 *
45 * @param config the Kafka Server Config
46 */
47 void restart(KafkaServerConfig config);
48
49 /**
50 * Sends message to Kafka Server.
51 *
52 * @param record a message to be sent
53 * @return metadata for a record that as been acknowledged
54 */
55 public Future<RecordMetadata> send(ProducerRecord<String, byte[]> record);
Sanjana Agarwalcb4a3db2016-07-14 11:42:48 -070056}