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 |
---|---|
void |
close()
Close the stream
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the stream
|
void |
close(long timeout,
Handler<AsyncResult<Void>> completionHandler)
Close the stream
|
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> |
flush(Handler<Void> completionHandler)
Invoking this method makes all buffered records immediately available to write
|
KafkaWriteStream<K,V> |
partitionsFor(String topic,
Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
Get the partition metadata for the give topic.
|
KafkaWriteStream<K,V> |
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
|
org.apache.kafka.clients.producer.Producer<K,V> |
unwrap() |
drainHandler, end, end, end, end, exceptionHandler, setWriteQueueMaxSize, write, write, writeQueueFull
static 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, org.apache.kafka.clients.producer.Producer<K,V> producer)
vertx
- Vert.x instance to useproducer
- native Kafka producer instanceKafkaWriteStream<K,V> send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record)
record
- record to writeKafkaWriteStream<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 completedKafkaWriteStream<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 completedCopyright © 2023 Eclipse. All rights reserved.