public interface KafkaProducer<K,V> extends WriteStream<KafkaProducerRecord<K,V>>
The WriteStream.write(Object) provides global control over writing a record.
| Modifier and Type | Method and Description |
|---|---|
KafkaWriteStream<K,V> |
asStream() |
void |
close()
Close the producer
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the producer
|
void |
close(long timeout,
Handler<AsyncResult<Void>> completionHandler)
Close the producer
|
static <K,V> KafkaProducer<K,V> |
create(Vertx vertx,
Map<String,String> config)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(Vertx vertx,
Map<String,String> config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(Vertx vertx,
org.apache.kafka.clients.producer.Producer<K,V> producer)
Create a new KafkaProducer instance from a native
Producer. |
static <K,V> KafkaProducer<K,V> |
create(Vertx vertx,
Properties config)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(Vertx vertx,
Properties config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
createShared(Vertx vertx,
String name,
Map<String,String> config)
Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same
name |
static <K,V> KafkaProducer<K,V> |
createShared(Vertx vertx,
String name,
Map<String,String> config,
Class<K> keyType,
Class<V> valueType)
Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same
name |
static <K,V> KafkaProducer<K,V> |
createShared(Vertx vertx,
String name,
Properties config)
Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same
name |
static <K,V> KafkaProducer<K,V> |
createShared(Vertx vertx,
String name,
Properties config,
Class<K> keyType,
Class<V> valueType)
Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same
name |
KafkaProducer<K,V> |
drainHandler(Handler<Void> handler) |
void |
end() |
void |
end(KafkaProducerRecord<K,V> kafkaProducerRecord) |
KafkaProducer<K,V> |
exceptionHandler(Handler<Throwable> handler) |
KafkaProducer<K,V> |
flush(Handler<Void> completionHandler)
Invoking this method makes all buffered records immediately available to write
|
KafkaProducer<K,V> |
partitionsFor(String topic,
Handler<AsyncResult<List<PartitionInfo>>> handler)
Get the partition metadata for the give topic.
|
KafkaProducer<K,V> |
setWriteQueueMaxSize(int i) |
org.apache.kafka.clients.producer.Producer<K,V> |
unwrap() |
KafkaProducer<K,V> |
write(KafkaProducerRecord<K,V> kafkaProducerRecord) |
KafkaProducer<K,V> |
write(KafkaProducerRecord<K,V> record,
Handler<AsyncResult<RecordMetadata>> handler)
Asynchronously write a record to a topic
|
boolean |
writeQueueFull() |
static <K,V> KafkaProducer<K,V> createShared(Vertx vertx, String name, Properties config)
namevertx - Vert.x instance to usename - the producer name to identify itconfig - Kafka producer configurationstatic <K,V> KafkaProducer<K,V> createShared(Vertx vertx, String name, Map<String,String> config)
namevertx - Vert.x instance to usename - the producer name to identify itconfig - Kafka producer configurationstatic <K,V> KafkaProducer<K,V> createShared(Vertx vertx, String name, Map<String,String> config, Class<K> keyType, Class<V> valueType)
namevertx - Vert.x instance to usename - the producer name to identify itconfig - Kafka producer configurationkeyType - class type for the key serializationvalueType - class type for the value serializationstatic <K,V> KafkaProducer<K,V> createShared(Vertx vertx, String name, Properties config, Class<K> keyType, Class<V> valueType)
namevertx - Vert.x instance to usename - the producer name to identify itconfig - Kafka producer configurationkeyType - class type for the key serializationvalueType - class type for the value serializationstatic <K,V> KafkaProducer<K,V> create(Vertx vertx, org.apache.kafka.clients.producer.Producer<K,V> producer)
Producer.vertx - Vert.x instance to useproducer - the Kafka producer to wrapstatic <K,V> KafkaProducer<K,V> create(Vertx vertx, Map<String,String> config)
vertx - Vert.x instance to useconfig - Kafka producer configurationstatic <K,V> KafkaProducer<K,V> create(Vertx vertx, Map<String,String> config, Class<K> keyType, Class<V> valueType)
vertx - Vert.x instance to useconfig - Kafka producer configurationkeyType - class type for the key serializationvalueType - class type for the value serializationstatic <K,V> KafkaProducer<K,V> create(Vertx vertx, Properties config)
vertx - Vert.x instance to useconfig - Kafka producer configurationstatic <K,V> KafkaProducer<K,V> create(Vertx vertx, Properties config, Class<K> keyType, Class<V> valueType)
vertx - Vert.x instance to useconfig - Kafka producer configurationkeyType - class type for the key serializationvalueType - class type for the value serializationKafkaProducer<K,V> exceptionHandler(Handler<Throwable> handler)
exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<KafkaProducerRecord<K,V>>KafkaProducer<K,V> write(KafkaProducerRecord<K,V> kafkaProducerRecord)
write in interface WriteStream<KafkaProducerRecord<K,V>>void end()
end in interface WriteStream<KafkaProducerRecord<K,V>>void end(KafkaProducerRecord<K,V> kafkaProducerRecord)
end in interface WriteStream<KafkaProducerRecord<K,V>>KafkaProducer<K,V> setWriteQueueMaxSize(int i)
setWriteQueueMaxSize in interface WriteStream<KafkaProducerRecord<K,V>>boolean writeQueueFull()
writeQueueFull in interface WriteStream<KafkaProducerRecord<K,V>>KafkaProducer<K,V> drainHandler(Handler<Void> handler)
drainHandler in interface WriteStream<KafkaProducerRecord<K,V>>KafkaProducer<K,V> write(KafkaProducerRecord<K,V> record, Handler<AsyncResult<RecordMetadata>> handler)
record - record to writehandler - handler called on operation completedKafkaProducer<K,V> partitionsFor(String topic, Handler<AsyncResult<List<PartitionInfo>>> handler)
topic - topic partition for which getting partitions infohandler - handler called on operation completedKafkaProducer<K,V> flush(Handler<Void> completionHandler)
completionHandler - handler called on operation completedvoid close()
void close(Handler<AsyncResult<Void>> completionHandler)
completionHandler - handler called on operation completedvoid close(long timeout,
Handler<AsyncResult<Void>> completionHandler)
timeout - timeout to wait for closingcompletionHandler - handler called on operation completedKafkaWriteStream<K,V> asStream()
KafkaWriteStream instanceCopyright © 2018 Eclipse. All rights reserved.