Sanjana Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 1 | /** |
| 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 Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 16 | package org.onosproject.kafkaintegration.api; |
| 17 | |
Shravan Ambati | 4c6295e | 2016-12-20 14:53:06 -0800 | [diff] [blame^] | 18 | import java.util.concurrent.Future; |
Yuta HIGUCHI | 9efba1e | 2016-07-09 11:07:13 -0700 | [diff] [blame] | 19 | |
Shravan Ambati | 4c6295e | 2016-12-20 14:53:06 -0800 | [diff] [blame^] | 20 | import org.onosproject.kafkaintegration.api.dto.KafkaServerConfig; |
| 21 | import org.apache.kafka.clients.producer.ProducerRecord; |
| 22 | import org.apache.kafka.clients.producer.RecordMetadata; |
Sanjana Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 23 | /** |
Shravan Ambati | 4c6295e | 2016-12-20 14:53:06 -0800 | [diff] [blame^] | 24 | * APIs for controlling the Kafka Producer. |
| 25 | * |
Sanjana Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 26 | */ |
| 27 | public interface KafkaPublisherService { |
| 28 | |
| 29 | /** |
Shravan Ambati | 4c6295e | 2016-12-20 14:53:06 -0800 | [diff] [blame^] | 30 | * Starts the Kafka Producer. |
Sanjana Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 31 | * |
Shravan Ambati | 4c6295e | 2016-12-20 14:53:06 -0800 | [diff] [blame^] | 32 | * @param config the Kafka Server Config |
Sanjana Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 33 | */ |
Shravan Ambati | 4c6295e | 2016-12-20 14:53:06 -0800 | [diff] [blame^] | 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); |
Sanjana Agarwal | cb4a3db | 2016-07-14 11:42:48 -0700 | [diff] [blame] | 56 | } |