public interface KafkaWriteStream<K,V>
extends io.vertx.core.streams.WriteStream<org.apache.kafka.clients.producer.ProducerRecord<K,V>>
WriteStream
for writing to Kafka ProducerRecord
.
The WriteStream.write(Object)
provides global control over writing a record.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_SIZE |
Modifier and Type | Method and Description |
---|---|
io.vertx.core.Future<Void> |
abortTransaction()
Like
abortTransaction(Handler) but with a future of the result |
KafkaWriteStream<K,V> |
abortTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Aborts the ongoing transaction.
|
io.vertx.core.Future<Void> |
beginTransaction()
Like
beginTransaction(Handler) but with a future of the result |
KafkaWriteStream<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 stream
|
void |
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Close the stream
|
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 stream
|
io.vertx.core.Future<Void> |
commitTransaction()
Like
commitTransaction(Handler) but with a future of the result |
KafkaWriteStream<K,V> |
commitTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Commits the ongoing transaction.
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
KafkaClientOptions options)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
KafkaClientOptions options,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
KafkaClientOptions options,
org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,Object> config)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,Object> config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,Object> config,
org.apache.kafka.common.serialization.Serializer<K> keySerializer,
org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
org.apache.kafka.clients.producer.Producer<K,V> producer)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<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 KafkaWriteStream instance
|
KafkaWriteStream<K,V> |
drainHandler(io.vertx.core.Handler<Void> handler) |
KafkaWriteStream<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 |
KafkaWriteStream<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 |
KafkaWriteStream<K,V> |
initTransactions(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Initializes the underlying kafka transactional producer.
|
io.vertx.core.Future<List<org.apache.kafka.common.PartitionInfo>> |
partitionsFor(String topic)
Like
partitionsFor(String, Handler) but returns a Future of the asynchronous result |
KafkaWriteStream<K,V> |
partitionsFor(String topic,
io.vertx.core.Handler<io.vertx.core.AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
Get the partition metadata for the give topic.
|
io.vertx.core.Future<org.apache.kafka.clients.producer.RecordMetadata> |
send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record)
Asynchronously write a record to a topic
|
KafkaWriteStream<K,V> |
send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record,
io.vertx.core.Handler<io.vertx.core.AsyncResult<org.apache.kafka.clients.producer.RecordMetadata>> handler)
Asynchronously write a record to a topic
|
KafkaWriteStream<K,V> |
setWriteQueueMaxSize(int i) |
org.apache.kafka.clients.producer.Producer<K,V> |
unwrap() |
static final int DEFAULT_MAX_SIZE
static <K,V> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, Properties config)
vertx
- Vert.x instance to useconfig
- Kafka producer configurationstatic <K,V> KafkaWriteStream<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 serializationstatic <K,V> KafkaWriteStream<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> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, Map<String,Object> config)
vertx
- Vert.x instance to useconfig
- Kafka producer configurationstatic <K,V> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, Map<String,Object> 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> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, Map<String,Object> 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> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, KafkaClientOptions options)
vertx
- Vert.x instance to useoptions
- Kafka producer optionsstatic <K,V> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, KafkaClientOptions options, Class<K> keyType, Class<V> valueType)
vertx
- Vert.x instance to useoptions
- Kafka producer optionskeyType
- class type for the key serializationvalueType
- class type for the value serializationstatic <K,V> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, KafkaClientOptions options, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
vertx
- Vert.x instance to useoptions
- Kafka producer optionskeySerializer
- key serializervalueSerializer
- value serializerstatic <K,V> KafkaWriteStream<K,V> create(io.vertx.core.Vertx vertx, org.apache.kafka.clients.producer.Producer<K,V> producer)
vertx
- Vert.x instance to useproducer
- native Kafka producer instanceKafkaWriteStream<K,V> exceptionHandler(io.vertx.core.Handler<Throwable> handler)
KafkaWriteStream<K,V> setWriteQueueMaxSize(int i)
KafkaWriteStream<K,V> drainHandler(io.vertx.core.Handler<Void> handler)
KafkaWriteStream<K,V> initTransactions(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
KafkaProducer.initTransactions()
()}handler
- handler called on operation completedio.vertx.core.Future<Void> initTransactions()
initTransactions(Handler)
but with a future of the resultKafkaWriteStream<K,V> beginTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
KafkaProducer.beginTransaction()
handler
- handler called on operation completedio.vertx.core.Future<Void> beginTransaction()
beginTransaction(Handler)
but with a future of the resultKafkaWriteStream<K,V> commitTransaction(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
KafkaProducer.commitTransaction()
handler
- handler called on operation completedio.vertx.core.Future<Void> commitTransaction()
commitTransaction(Handler)
but with a future of the resultKafkaWriteStream<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 resultio.vertx.core.Future<org.apache.kafka.clients.producer.RecordMetadata> send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record)
record
- record to writeFuture
completed with the record metadataKafkaWriteStream<K,V> send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<org.apache.kafka.clients.producer.RecordMetadata>> handler)
record
- record to writehandler
- handler called on operation completedKafkaWriteStream<K,V> partitionsFor(String topic, io.vertx.core.Handler<io.vertx.core.AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
topic
- topic partition for which getting partitions infohandler
- handler called on operation completedio.vertx.core.Future<List<org.apache.kafka.common.PartitionInfo>> partitionsFor(String topic)
partitionsFor(String, Handler)
but returns a Future
of the asynchronous resultKafkaWriteStream<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()
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 completedio.vertx.core.Future<Void> close(long timeout)
close(long, Handler)
but returns a Future
of the asynchronous resultCopyright © 2021 Eclipse. All rights reserved.