public final class KafkaProducer extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
KafkaProducer.ProducerBuilder |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static void |
main(String[] args) |
static KafkaProducer.ProducerBuilder |
newBuilder(String servers,
String topic,
String clientId) |
void |
produce(String key,
String value) |
public void produce(String key, String value)
key - Key to producevalue - Value to producepublic void close()
public static KafkaProducer.ProducerBuilder newBuilder(String servers, String topic, String clientId)
servers - One or more host port pairs separated by commas.topic - The topic to send messages.clientId - The id of this client.KafkaProducer.ProducerBuilderpublic static void main(String[] args)
args - Input parameters.Copyright © 2019. All rights reserved.