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 |
---|---|
io.vertx.core.Future<Void> |
abortTransaction()
Like
abortTransaction(Handler) but with a future of the result |
KafkaProducer<K,V> |
abortTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Aborts the ongoing transaction.
|
KafkaWriteStream<K,V> |
asStream() |
io.vertx.core.Future<Void> |
beginTransaction()
Like
beginTransaction(Handler) but with a future of the result |
KafkaProducer<K,V> |
beginTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Starts a new kafka transaction.
|
io.vertx.core.Future<Void> |
close()
Close the producer
|
void |
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Close the producer
|
io.vertx.core.Future<Void> |
close(long timeout)
Like
close(long, Handler) but returns a Future of the asynchronous result |
void |
close(long timeout,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Close the producer
|
io.vertx.core.Future<Void> |
commitTransaction()
Like
commitTransaction(Handler) but with a future of the result |
KafkaProducer<K,V> |
commitTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Commits the ongoing transaction.
|
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,
KafkaClientOptions options)
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,
KafkaClientOptions options,
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,
KafkaClientOptions options,
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,
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) |
io.vertx.core.Future<Void> |
flush()
Like
flush(Handler) but returns a Future of the asynchronous result |
KafkaProducer<K,V> |
flush(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Invoking this method makes all buffered records immediately available to write
|
io.vertx.core.Future<Void> |
initTransactions()
Like
initTransactions(Handler) but with a future of the result |
KafkaProducer<K,V> |
initTransactions(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Initializes the underlying kafka transactional producer.
|
io.vertx.core.Future<List<PartitionInfo>> |
partitionsFor(String topic)
Like
partitionsFor(String, Handler) but returns a Future of the asynchronous result |
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.
|
io.vertx.core.Future<RecordMetadata> |
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() |
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, KafkaClientOptions options)
name
vertx
- Vert.x instance to usename
- the producer name to identify itoptions
- Kafka producer optionsstatic <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> createShared(io.vertx.core.Vertx vertx, String name, KafkaClientOptions options, 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 itoptions
- Kafka producer optionskeySerializer
- key serializervalueSerializer
- value serializerstatic <K,V> KafkaProducer<K,V> createShared(io.vertx.core.Vertx vertx, String name, KafkaClientOptions options, Class<K> keyType, Class<V> valueType)
name
vertx
- Vert.x instance to usename
- the producer name to identify itoptions
- Kafka producer optionskeyType
- 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> initTransactions(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
initTransactions()
()}handler
- handler called on operation completedio.vertx.core.Future<Void> initTransactions()
initTransactions(Handler)
but with a future of the resultKafkaProducer<K,V> beginTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
beginTransaction()
handler
- handler called on operation completedio.vertx.core.Future<Void> beginTransaction()
beginTransaction(Handler)
but with a future of the resultKafkaProducer<K,V> commitTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
commitTransaction()
handler
- handler called on operation completedio.vertx.core.Future<Void> commitTransaction()
commitTransaction(Handler)
but with a future of the resultKafkaProducer<K,V> abortTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
KafkaProducer.abortTransaction()
handler
- handler called on operation completedio.vertx.core.Future<Void> abortTransaction()
abortTransaction(Handler)
but with a future of the resultKafkaProducer<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> setWriteQueueMaxSize(int i)
setWriteQueueMaxSize
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>>
io.vertx.core.Future<RecordMetadata> send(KafkaProducerRecord<K,V> record)
record
- record to writeFuture
completed with the record metadataKafkaProducer<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 completedio.vertx.core.Future<List<PartitionInfo>> partitionsFor(String topic)
partitionsFor(String, Handler)
but returns a Future
of the asynchronous resultKafkaProducer<K,V> flush(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
completionHandler
- handler called on operation completedio.vertx.core.Future<Void> flush()
flush(Handler)
but returns a Future
of the asynchronous resultio.vertx.core.Future<Void> close()
Future
completed with the operation resultvoid close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
completionHandler
- handler called on operation completedio.vertx.core.Future<Void> close(long timeout)
close(long, Handler)
but returns a Future
of the asynchronous resultvoid 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 © 2020 Eclipse. All rights reserved.