blob: d29cd477054f5d6653b15c9d65b54ce932e38e42 [file] [log] [blame]
Shravan Ambati5a11e172016-07-21 15:55:28 -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 */
16package org.onosproject.kafkaintegration.api;
17
18import java.util.concurrent.Future;
19
20import org.onosproject.kafkaintegration.api.dto.KafkaServerConfig;
21import org.apache.kafka.clients.producer.ProducerRecord;
22import org.apache.kafka.clients.producer.RecordMetadata;
23/**
24 * APIs for controlling the Kafka Producer.
25 *
26 */
27public interface KafkaProducerService {
28
29 /**
30 * Starts the Kafka Producer.
31 *
32 * @param config the Kafka Server Config
33 */
34 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);
56}