public interface KafkaProducer<K,V> extends io.vertx.core.streams.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(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Close the producer
|
void |
close(long timeout,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Close the producer
|
static <K,V> KafkaProducer<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,String> config)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,String> config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,String> config,
org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(io.vertx.core.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(io.vertx.core.Vertx vertx,
Properties config)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config,
org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
Create a new KafkaProducer instance
|
static <K,V> KafkaProducer<K,V> |
createShared(io.vertx.core.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(io.vertx.core.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(io.vertx.core.Vertx vertx,
String name,
Map<String,String> config,
org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
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(io.vertx.core.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(io.vertx.core.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 |
static <K,V> KafkaProducer<K,V> |
createShared(io.vertx.core.Vertx vertx,
String name,
Properties config,
org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same
name |
KafkaProducer<K,V> |
drainHandler(io.vertx.core.Handler<Void> handler) |
KafkaProducer<K,V> |
exceptionHandler(io.vertx.core.Handler<Throwable> handler) |
KafkaProducer<K,V> |
flush(io.vertx.core.Handler<Void> completionHandler)
Invoking this method makes all buffered records immediately available to write
|
KafkaProducer<K,V> |
partitionsFor(String topic,
io.vertx.core.Handler<io.vertx.core.AsyncResult<List<PartitionInfo>>> handler)
Get the partition metadata for the give topic.
|
KafkaProducer<K,V> |
send(KafkaProducerRecord<K,V> record)
Asynchronously write a record to a topic
|
KafkaProducer<K,V> |
send(KafkaProducerRecord<K,V> record,
io.vertx.core.Handler<io.vertx.core.AsyncResult<RecordMetadata>> handler)
Asynchronously write a record to a 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> data,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler) |
boolean |
writeQueueFull() |
static <K,V> KafkaProducer<K,V> createShared(io.vertx.core.Vertx vertx, String name, Properties config)
name
vertx
- Vert.x instance to usename
- the producer name to identify itconfig
- Kafka producer configurationstatic <K,V> KafkaProducer<K,V> createShared(io.vertx.core.Vertx vertx, String name, Map<String,String> config)
name
vertx
- Vert.x instance to usename
- the producer name to identify itconfig
- Kafka producer configurationstatic <K,V> KafkaProducer<K,V> createShared(io.vertx.core.Vertx vertx, String name, Map<String,String> config, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
name
vertx
- Vert.x instance to usename
- the producer name to identify itconfig
- Kafka producer configurationkeySerializer
- key serializervalueSerializer
- value serializerstatic <K,V> KafkaProducer<K,V> createShared(io.vertx.core.Vertx vertx, String name, Map<String,String> config, Class<K> keyType, Class<V> valueType)
name
vertx
- 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(io.vertx.core.Vertx vertx, String name, Properties config, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
name
vertx
- Vert.x instance to usename
- the producer name to identify itconfig
- Kafka producer configurationkeySerializer
- key serializervalueSerializer
- value serializerstatic <K,V> KafkaProducer<K,V> createShared(io.vertx.core.Vertx vertx, String name, Properties config, Class<K> keyType, Class<V> valueType)
name
vertx
- 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(io.vertx.core.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(io.vertx.core.Vertx vertx, Map<String,String> config)
vertx
- Vert.x instance to useconfig
- Kafka producer configurationstatic <K,V> KafkaProducer<K,V> create(io.vertx.core.Vertx vertx, Map<String,String> config, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
vertx
- Vert.x instance to useconfig
- Kafka producer configurationkeySerializer
- key serializervalueSerializer
- value serializerstatic <K,V> KafkaProducer<K,V> create(io.vertx.core.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(io.vertx.core.Vertx vertx, Properties config)
vertx
- Vert.x instance to useconfig
- Kafka producer configurationstatic <K,V> KafkaProducer<K,V> create(io.vertx.core.Vertx vertx, Properties config, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
vertx
- Vert.x instance to useconfig
- Kafka producer configurationkeySerializer
- key serializervalueSerializer
- value serializerstatic <K,V> KafkaProducer<K,V> create(io.vertx.core.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(io.vertx.core.Handler<Throwable> handler)
exceptionHandler
in interface io.vertx.core.streams.StreamBase
exceptionHandler
in interface io.vertx.core.streams.WriteStream<KafkaProducerRecord<K,V>>
KafkaProducer<K,V> write(KafkaProducerRecord<K,V> kafkaProducerRecord)
write
in interface io.vertx.core.streams.WriteStream<KafkaProducerRecord<K,V>>
KafkaProducer<K,V> setWriteQueueMaxSize(int i)
setWriteQueueMaxSize
in interface io.vertx.core.streams.WriteStream<KafkaProducerRecord<K,V>>
boolean writeQueueFull()
writeQueueFull
in interface io.vertx.core.streams.WriteStream<KafkaProducerRecord<K,V>>
KafkaProducer<K,V> drainHandler(io.vertx.core.Handler<Void> handler)
drainHandler
in interface io.vertx.core.streams.WriteStream<KafkaProducerRecord<K,V>>
KafkaProducer<K,V> write(KafkaProducerRecord<K,V> data, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
write
in interface io.vertx.core.streams.WriteStream<KafkaProducerRecord<K,V>>
KafkaProducer<K,V> send(KafkaProducerRecord<K,V> record)
record
- record to writeKafkaProducer<K,V> send(KafkaProducerRecord<K,V> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<RecordMetadata>> handler)
record
- record to writehandler
- handler called on operation completedKafkaProducer<K,V> partitionsFor(String topic, io.vertx.core.Handler<io.vertx.core.AsyncResult<List<PartitionInfo>>> handler)
topic
- topic partition for which getting partitions infohandler
- handler called on operation completedKafkaProducer<K,V> flush(io.vertx.core.Handler<Void> completionHandler)
completionHandler
- handler called on operation completedvoid close()
void close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
completionHandler
- handler called on operation completedvoid close(long timeout, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
timeout
- timeout to wait for closingcompletionHandler
- handler called on operation completedKafkaWriteStream<K,V> asStream()
KafkaWriteStream
instanceCopyright © 2019 Eclipse. All rights reserved.