public interface KafkaWriteStream<K,V> extends 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 |
|---|---|
KafkaWriteStream<K,V> |
abortTransaction(Handler<AsyncResult<Void>> handler)
Aborts the ongoing transaction.
|
KafkaWriteStream<K,V> |
beginTransaction(Handler<AsyncResult<Void>> handler)
Starts a new kafka transaction.
|
Future<Void> |
close()
Close the stream
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the stream
|
Future<Void> |
close(long timeout)
Like
close(long, Handler) but returns a Future of the asynchronous result |
void |
close(long timeout,
Handler<AsyncResult<Void>> completionHandler)
Close the stream
|
KafkaWriteStream<K,V> |
commitTransaction(Handler<AsyncResult<Void>> handler)
Commits the ongoing transaction.
|
static <K,V> KafkaWriteStream<K,V> |
create(Vertx vertx,
KafkaClientOptions options)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(Vertx vertx,
KafkaClientOptions options,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(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(Vertx vertx,
Map<String,Object> config)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(Vertx vertx,
Map<String,Object> config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(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(Vertx vertx,
org.apache.kafka.clients.producer.Producer<K,V> producer)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(Vertx vertx,
Properties config)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(Vertx vertx,
Properties config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaWriteStream instance
|
static <K,V> KafkaWriteStream<K,V> |
create(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(Handler<Void> handler) |
KafkaWriteStream<K,V> |
exceptionHandler(Handler<Throwable> handler) |
Future<Void> |
flush()
Like
flush(Handler) but returns a Future of the asynchronous result |
KafkaWriteStream<K,V> |
flush(Handler<AsyncResult<Void>> completionHandler)
Invoking this method makes all buffered records immediately available to write
|
KafkaWriteStream<K,V> |
initTransactions(Handler<AsyncResult<Void>> handler)
Initializes the underlying kafka transactional producer.
|
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,
Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
Get the partition metadata for the give topic.
|
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,
Handler<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() |
end, end, end, end, write, write, writeQueueFullstatic final int DEFAULT_MAX_SIZE
static <K,V> KafkaWriteStream<K,V> create(Vertx vertx, Properties config)
vertx - Vert.x instance to useconfig - Kafka producer configurationstatic <K,V> KafkaWriteStream<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 serializationstatic <K,V> KafkaWriteStream<K,V> create(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(Vertx vertx, Map<String,Object> config)
vertx - Vert.x instance to useconfig - Kafka producer configurationstatic <K,V> KafkaWriteStream<K,V> create(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(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(Vertx vertx, KafkaClientOptions options)
vertx - Vert.x instance to useoptions - Kafka producer optionsstatic <K,V> KafkaWriteStream<K,V> create(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(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(Vertx vertx, org.apache.kafka.clients.producer.Producer<K,V> producer)
vertx - Vert.x instance to useproducer - native Kafka producer instanceKafkaWriteStream<K,V> exceptionHandler(Handler<Throwable> handler)
exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<org.apache.kafka.clients.producer.ProducerRecord<K,V>>KafkaWriteStream<K,V> setWriteQueueMaxSize(int i)
setWriteQueueMaxSize in interface WriteStream<org.apache.kafka.clients.producer.ProducerRecord<K,V>>KafkaWriteStream<K,V> drainHandler(Handler<Void> handler)
drainHandler in interface WriteStream<org.apache.kafka.clients.producer.ProducerRecord<K,V>>KafkaWriteStream<K,V> initTransactions(Handler<AsyncResult<Void>> handler)
KafkaProducer#initTransactions() ()}handler - handler called on operation completedKafkaWriteStream<K,V> beginTransaction(Handler<AsyncResult<Void>> handler)
KafkaProducer#beginTransaction()handler - handler called on operation completedKafkaWriteStream<K,V> commitTransaction(Handler<AsyncResult<Void>> handler)
KafkaProducer#commitTransaction()handler - handler called on operation completedKafkaWriteStream<K,V> abortTransaction(Handler<AsyncResult<Void>> handler)
KafkaProducer.abortTransaction()handler - handler called on operation completedFuture<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, Handler<AsyncResult<org.apache.kafka.clients.producer.RecordMetadata>> handler)
record - record to writehandler - handler called on operation completedKafkaWriteStream<K,V> partitionsFor(String topic, Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
topic - topic partition for which getting partitions infohandler - handler called on operation completedFuture<List<org.apache.kafka.common.PartitionInfo>> partitionsFor(String topic)
partitionsFor(String, Handler) but returns a Future of the asynchronous resultKafkaWriteStream<K,V> flush(Handler<AsyncResult<Void>> completionHandler)
completionHandler - handler called on operation completedFuture<Void> flush()
flush(Handler) but returns a Future of the asynchronous resultvoid 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 completedFuture<Void> close(long timeout)
close(long, Handler) but returns a Future of the asynchronous resultCopyright © 2020 Eclipse. All rights reserved.