interface KafkaReadStream<K : Any, V : Any> : ReadStream<ConsumerRecord<K, V>>
A ReadStream for consuming Kafka ConsumerRecord.
The #pause() and #resume() provides global control over reading the records from the consumer.
The #pause(Set) and #resume(Set) provides finer grained control over reading records for specific Topic/Partition, these are Kafka's specific operations.
abstract fun assign(partitions: MutableSet<TopicPartition>): KafkaReadStream<K, V>abstract fun assign(partitions: MutableSet<TopicPartition>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Manually assign a list of partition to this consumer. |
|
abstract fun assignment(handler: Handler<AsyncResult<MutableSet<TopicPartition>>>): KafkaReadStream<K, V>
Get the set of partitions currently assigned to this consumer. |
|
abstract fun batchHandler(handler: Handler<ConsumerRecords<K, V>>): KafkaReadStream<K, V>
Set the handler that will be called when a new batch of records is returned from Kafka. Batch handlers need to take care not to block the event loop when dealing with large batches. It is better to process records individually using the |
|
abstract fun beginningOffsets(topicPartitions: MutableSet<TopicPartition>, handler: Handler<AsyncResult<MutableMap<TopicPartition, Long>>>): Unit
Get the first offset for the given partitions. abstract fun beginningOffsets(topicPartition: TopicPartition, handler: Handler<AsyncResult<Long>>): Unit
Get the first offset for the given partition. |
|
open fun close(): Unitabstract fun close(completionHandler: Handler<AsyncResult<Void>>): Unit
Close the stream |
|
abstract fun commit(): Unitabstract fun commit(completionHandler: Handler<AsyncResult<MutableMap<TopicPartition, OffsetAndMetadata>>>): Unit
Commit current offsets for all the subscribed list of topics and partition. abstract fun commit(offsets: MutableMap<TopicPartition, OffsetAndMetadata>): Unitabstract fun commit(offsets: MutableMap<TopicPartition, OffsetAndMetadata>, completionHandler: Handler<AsyncResult<MutableMap<TopicPartition, OffsetAndMetadata>>>): Unit
Commit the specified offsets for the specified list of topics and partitions to Kafka. |
|
abstract fun committed(topicPartition: TopicPartition, handler: Handler<AsyncResult<OffsetAndMetadata>>): Unit
Get the last committed offset for the given partition (whether the commit happened by this process or another). |
|
open static fun <K : Any, V : Any> create(vertx: Vertx, config: Properties): KafkaReadStream<K, V>open static fun <K : Any, V : Any> create(vertx: Vertx, config: Properties, keyType: Class<K>, valueType: Class<V>): KafkaReadStream<K, V>open static fun <K : Any, V : Any> create(vertx: Vertx, config: MutableMap<String, Any>): KafkaReadStream<K, V>open static fun <K : Any, V : Any> create(vertx: Vertx, config: MutableMap<String, Any>, keyType: Class<K>, valueType: Class<V>): KafkaReadStream<K, V>open static fun <K : Any, V : Any> create(vertx: Vertx, consumer: Consumer<K, V>): KafkaReadStream<K, V>
Create a new KafkaReadStream instance |
|
abstract fun endOffsets(topicPartitions: MutableSet<TopicPartition>, handler: Handler<AsyncResult<MutableMap<TopicPartition, Long>>>): Unit
Get the last offset for the given partitions. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1. abstract fun endOffsets(topicPartition: TopicPartition, handler: Handler<AsyncResult<Long>>): Unit
Get the last offset for the given partition. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1. |
|
abstract fun listTopics(handler: Handler<AsyncResult<MutableMap<String, MutableList<PartitionInfo>>>>): KafkaReadStream<K, V>
Get metadata about partitions for all topics that the user is authorized to view. |
|
abstract fun offsetsForTimes(topicPartitionTimestamps: MutableMap<TopicPartition, Long>, handler: Handler<AsyncResult<MutableMap<TopicPartition, OffsetAndTimestamp>>>): Unit
Look up the offsets for the given partitions by timestamp. abstract fun offsetsForTimes(topicPartition: TopicPartition, timestamp: Long, handler: Handler<AsyncResult<OffsetAndTimestamp>>): Unit
* Look up the offset for the given partition by timestamp. |
|
abstract fun partitionsAssignedHandler(handler: Handler<MutableSet<TopicPartition>>): KafkaReadStream<K, V>
Set the handler called when topic partitions are assigned to the consumer |
|
abstract fun partitionsFor(topic: String, handler: Handler<AsyncResult<MutableList<PartitionInfo>>>): KafkaReadStream<K, V>
Get metadata about the partitions for a given topic. |
|
abstract fun partitionsRevokedHandler(handler: Handler<MutableSet<TopicPartition>>): KafkaReadStream<K, V>
Set the handler called when topic partitions are revoked to the consumer |
|
abstract fun pause(topicPartitions: MutableSet<TopicPartition>): KafkaReadStream<K, V>abstract fun pause(topicPartitions: MutableSet<TopicPartition>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Suspend fetching from the requested partitions. |
|
abstract fun paused(handler: Handler<AsyncResult<MutableSet<TopicPartition>>>): Unit
Get the set of partitions that were previously paused by a call to |
|
abstract fun position(partition: TopicPartition, handler: Handler<AsyncResult<Long>>): Unit
Get the offset of the next record that will be fetched (if a record with that offset exists). |
|
abstract fun resume(topicPartitions: MutableSet<TopicPartition>): KafkaReadStream<K, V>abstract fun resume(topicPartitions: MutableSet<TopicPartition>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Resume specified partitions which have been paused with pause. |
|
abstract fun seek(topicPartition: TopicPartition, offset: Long): KafkaReadStream<K, V>abstract fun seek(topicPartition: TopicPartition, offset: Long, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Overrides the fetch offsets that the consumer will use on the next poll. |
|
abstract fun seekToBeginning(topicPartitions: MutableSet<TopicPartition>): KafkaReadStream<K, V>abstract fun seekToBeginning(topicPartitions: MutableSet<TopicPartition>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Seek to the first offset for each of the given partitions. |
|
abstract fun seekToEnd(topicPartitions: MutableSet<TopicPartition>): KafkaReadStream<K, V>abstract fun seekToEnd(topicPartitions: MutableSet<TopicPartition>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Seek to the last offset for each of the given partitions. |
|
abstract fun subscribe(topics: MutableSet<String>): KafkaReadStream<K, V>abstract fun subscribe(topics: MutableSet<String>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Subscribe to the given list of topics to get dynamically assigned partitions. |
|
abstract fun subscription(handler: Handler<AsyncResult<MutableSet<String>>>): KafkaReadStream<K, V>
Get the current subscription. |
|
abstract fun unsubscribe(): KafkaReadStream<K, V>abstract fun unsubscribe(completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>
Unsubscribe from topics currently subscribed with subscribe. |
|
abstract fun unwrap(): Consumer<K, V> |