public interface KafkaConsumer<K,V> extends io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
You receive Kafka records by providing a handler(Handler)
. As messages arrive the handler
will be called with the records.
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.
Modifier and Type | Method and Description |
---|---|
io.vertx.core.Future<Void> |
assign(Set<TopicPartition> topicPartitions)
Manually assign a list of partition to this consumer.
|
KafkaConsumer<K,V> |
assign(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Manually assign a list of partition to this consumer.
|
io.vertx.core.Future<Void> |
assign(TopicPartition topicPartition)
Manually assign a partition to this consumer.
|
KafkaConsumer<K,V> |
assign(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Manually assign a partition to this consumer.
|
io.vertx.core.Future<Set<TopicPartition>> |
assignment()
Like
assignment(Handler) but returns a Future of the asynchronous result |
KafkaConsumer<K,V> |
assignment(io.vertx.core.Handler<io.vertx.core.AsyncResult<Set<TopicPartition>>> handler)
Get the set of partitions currently assigned to this consumer.
|
KafkaReadStream<K,V> |
asStream() |
KafkaConsumer<K,V> |
batchHandler(io.vertx.core.Handler<KafkaConsumerRecords<K,V>> handler)
Set the handler to be used when batches of messages are fetched
from the Kafka server.
|
io.vertx.core.Future<Map<TopicPartition,Long>> |
beginningOffsets(Set<TopicPartition> topicPartitions)
Like
beginningOffsets(Set, Handler) but returns a Future of the asynchronous result |
void |
beginningOffsets(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,Long>>> handler)
Get the first offset for the given partitions.
|
io.vertx.core.Future<Long> |
beginningOffsets(TopicPartition topicPartition)
Like
beginningOffsets(TopicPartition, Handler) but returns a Future of the asynchronous result |
void |
beginningOffsets(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> handler)
Get the first offset for the given partitions.
|
io.vertx.core.Future<Void> |
close()
Close the consumer
|
void |
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Close the consumer
|
io.vertx.core.Future<Void> |
commit()
Commit current offsets for all the subscribed list of topics and partition.
|
void |
commit(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Commit current offsets for all the subscribed list of topics and partition.
|
io.vertx.core.Future<Map<TopicPartition,OffsetAndMetadata>> |
commit(Map<TopicPartition,OffsetAndMetadata> offsets)
Commit the specified offsets for the specified list of topics and partitions to Kafka.
|
void |
commit(Map<TopicPartition,OffsetAndMetadata> offsets,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,OffsetAndMetadata>>> completionHandler)
Commit the specified offsets for the specified list of topics and partitions to Kafka.
|
io.vertx.core.Future<OffsetAndMetadata> |
committed(TopicPartition topicPartition)
Like
committed(TopicPartition, Handler) but returns a Future of the asynchronous result |
void |
committed(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<OffsetAndMetadata>> handler)
Get the last committed offset for the given partition (whether the commit happened by this process or another).
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Create a new KafkaConsumer instance from a native
Consumer . |
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
KafkaClientOptions options)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
KafkaClientOptions options,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
KafkaClientOptions options,
org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer,
org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,String> config)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,String> config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
Map<String,String> config,
org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer,
org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaConsumer instance
|
static <K,V> KafkaConsumer<K,V> |
create(io.vertx.core.Vertx vertx,
Properties config,
org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer,
org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
Create a new KafkaConsumer instance
|
long |
demand()
Returns the current demand.
|
KafkaConsumer<K,V> |
endHandler(io.vertx.core.Handler<Void> endHandler) |
io.vertx.core.Future<Map<TopicPartition,Long>> |
endOffsets(Set<TopicPartition> topicPartitions)
Like
endOffsets(Set, Handler) but returns a Future of the asynchronous result |
void |
endOffsets(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,Long>>> handler)
Get the last offset for the given partitions.
|
io.vertx.core.Future<Long> |
endOffsets(TopicPartition topicPartition)
Like
endOffsets(TopicPartition, Handler) but returns a Future of the asynchronous result |
void |
endOffsets(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> handler)
Get the last offset for the given partition.
|
KafkaConsumer<K,V> |
exceptionHandler(io.vertx.core.Handler<Throwable> handler) |
KafkaConsumer<K,V> |
fetch(long amount) |
KafkaConsumer<K,V> |
handler(io.vertx.core.Handler<KafkaConsumerRecord<K,V>> handler) |
io.vertx.core.Future<Map<String,List<PartitionInfo>>> |
listTopics()
Like
listTopics(Handler) but returns a Future of the asynchronous result |
KafkaConsumer<K,V> |
listTopics(io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<String,List<PartitionInfo>>>> handler)
Get metadata about partitions for all topics that the user is authorized to view.
|
io.vertx.core.Future<Map<TopicPartition,OffsetAndTimestamp>> |
offsetsForTimes(Map<TopicPartition,Long> topicPartitionTimestamps)
Like
offsetsForTimes(Map, Handler) but returns a Future of the asynchronous result |
void |
offsetsForTimes(Map<TopicPartition,Long> topicPartitionTimestamps,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,OffsetAndTimestamp>>> handler)
Look up the offsets for the given partitions by timestamp.
|
io.vertx.core.Future<OffsetAndTimestamp> |
offsetsForTimes(TopicPartition topicPartition,
Long timestamp)
Like
offsetsForTimes(TopicPartition, Long, Handler) but returns a Future of the asynchronous result |
void |
offsetsForTimes(TopicPartition topicPartition,
Long timestamp,
io.vertx.core.Handler<io.vertx.core.AsyncResult<OffsetAndTimestamp>> handler)
Look up the offset for the given partition by timestamp.
|
KafkaConsumer<K,V> |
partitionsAssignedHandler(io.vertx.core.Handler<Set<TopicPartition>> handler)
Set the handler called when topic partitions are assigned to the consumer
|
io.vertx.core.Future<List<PartitionInfo>> |
partitionsFor(String topic)
Like
partitionsFor(String, Handler) but returns a Future of the asynchronous result |
KafkaConsumer<K,V> |
partitionsFor(String topic,
io.vertx.core.Handler<io.vertx.core.AsyncResult<List<PartitionInfo>>> handler)
Get metadata about the partitions for a given topic.
|
KafkaConsumer<K,V> |
partitionsRevokedHandler(io.vertx.core.Handler<Set<TopicPartition>> handler)
Set the handler called when topic partitions are revoked to the consumer
|
KafkaConsumer<K,V> |
pause() |
io.vertx.core.Future<Void> |
pause(Set<TopicPartition> topicPartitions)
Suspend fetching from the requested partitions.
|
KafkaConsumer<K,V> |
pause(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Suspend fetching from the requested partitions.
|
io.vertx.core.Future<Void> |
pause(TopicPartition topicPartition)
Suspend fetching from the requested partition.
|
KafkaConsumer<K,V> |
pause(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Suspend fetching from the requested partition.
|
io.vertx.core.Future<Set<TopicPartition>> |
paused()
Like
paused(Handler) but returns a Future of the asynchronous result |
void |
paused(io.vertx.core.Handler<io.vertx.core.AsyncResult<Set<TopicPartition>>> handler)
Get the set of partitions that were previously paused by a call to pause(Set).
|
io.vertx.core.Future<KafkaConsumerRecords<K,V>> |
poll(Duration timeout)
Like
poll(Duration, Handler) but returns a Future of the asynchronous result |
void |
poll(Duration timeout,
io.vertx.core.Handler<io.vertx.core.AsyncResult<KafkaConsumerRecords<K,V>>> handler)
Executes a poll for getting messages from Kafka.
|
KafkaConsumer<K,V> |
pollTimeout(Duration timeout)
Sets the poll timeout for the underlying native Kafka Consumer.
|
io.vertx.core.Future<Long> |
position(TopicPartition partition)
Like
position(TopicPartition, Handler) but returns a Future of the asynchronous result |
void |
position(TopicPartition partition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> handler)
Get the offset of the next record that will be fetched (if a record with that offset exists).
|
KafkaConsumer<K,V> |
resume() |
io.vertx.core.Future<Void> |
resume(Set<TopicPartition> topicPartitions)
Resume specified partitions which have been paused with pause.
|
KafkaConsumer<K,V> |
resume(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Resume specified partitions which have been paused with pause.
|
io.vertx.core.Future<Void> |
resume(TopicPartition topicPartition)
Resume specified partition which have been paused with pause.
|
KafkaConsumer<K,V> |
resume(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Resume specified partition which have been paused with pause.
|
io.vertx.core.Future<Void> |
seek(TopicPartition topicPartition,
long offset)
Overrides the fetch offsets that the consumer will use on the next poll.
|
KafkaConsumer<K,V> |
seek(TopicPartition topicPartition,
long offset,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Overrides the fetch offsets that the consumer will use on the next poll.
|
io.vertx.core.Future<Void> |
seekToBeginning(Set<TopicPartition> topicPartitions)
Seek to the first offset for each of the given partitions.
|
KafkaConsumer<K,V> |
seekToBeginning(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Seek to the first offset for each of the given partitions.
|
io.vertx.core.Future<Void> |
seekToBeginning(TopicPartition topicPartition)
Seek to the first offset for each of the given partition.
|
KafkaConsumer<K,V> |
seekToBeginning(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Seek to the first offset for each of the given partition.
|
io.vertx.core.Future<Void> |
seekToEnd(Set<TopicPartition> topicPartitions)
Seek to the last offset for each of the given partitions.
|
KafkaConsumer<K,V> |
seekToEnd(Set<TopicPartition> topicPartitions,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Seek to the last offset for each of the given partitions.
|
io.vertx.core.Future<Void> |
seekToEnd(TopicPartition topicPartition)
Seek to the last offset for each of the given partition.
|
KafkaConsumer<K,V> |
seekToEnd(TopicPartition topicPartition,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Seek to the last offset for each of the given partition.
|
io.vertx.core.Future<Void> |
subscribe(Pattern pattern)
Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
|
KafkaConsumer<K,V> |
subscribe(Pattern pattern,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
|
io.vertx.core.Future<Void> |
subscribe(Set<String> topics)
Subscribe to the given list of topics to get dynamically assigned partitions.
|
KafkaConsumer<K,V> |
subscribe(Set<String> topics,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Subscribe to the given list of topics to get dynamically assigned partitions.
|
io.vertx.core.Future<Void> |
subscribe(String topic)
Subscribe to the given topic to get dynamically assigned partitions.
|
KafkaConsumer<K,V> |
subscribe(String topic,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Subscribe to the given topic to get dynamically assigned partitions.
|
io.vertx.core.Future<Set<String>> |
subscription()
Like
subscription(Handler) but returns a Future of the asynchronous result |
KafkaConsumer<K,V> |
subscription(io.vertx.core.Handler<io.vertx.core.AsyncResult<Set<String>>> handler)
Get the current subscription.
|
io.vertx.core.Future<Void> |
unsubscribe()
Unsubscribe from topics currently subscribed with subscribe.
|
KafkaConsumer<K,V> |
unsubscribe(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Unsubscribe from topics currently subscribed with subscribe.
|
org.apache.kafka.clients.consumer.Consumer<K,V> |
unwrap() |
static <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Consumer
.vertx
- Vert.x instance to useconsumer
- the Kafka consumer to wrapstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, Map<String,String> config)
vertx
- Vert.x instance to useconfig
- Kafka consumer configurationstatic <K,V> KafkaConsumer<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 consumer configurationkeyType
- class type for the key deserializationvalueType
- class type for the value deserializationstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, Map<String,String> config, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
vertx
- Vert.x instance to useconfig
- Kafka consumer configurationkeyDeserializer
- key deserializervalueDeserializer
- value deserializerstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, KafkaClientOptions options)
vertx
- Vert.x instance to useoptions
- Kafka consumer optionsstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, KafkaClientOptions options, Class<K> keyType, Class<V> valueType)
vertx
- Vert.x instance to useoptions
- Kafka consumer optionskeyType
- class type for the key deserializationvalueType
- class type for the value deserializationstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, KafkaClientOptions options, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
vertx
- Vert.x instance to useoptions
- Kafka consumer optionskeyDeserializer
- key deserializervalueDeserializer
- value deserializerstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, Properties config)
vertx
- Vert.x instance to useconfig
- Kafka consumer configurationstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, Properties config, Class<K> keyType, Class<V> valueType)
vertx
- Vert.x instance to useconfig
- Kafka consumer configurationkeyType
- class type for the key deserializationvalueType
- class type for the value deserializationstatic <K,V> KafkaConsumer<K,V> create(io.vertx.core.Vertx vertx, Properties config, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
vertx
- Vert.x instance to useconfig
- Kafka consumer configurationkeyDeserializer
- key deserializervalueDeserializer
- value deserializerKafkaConsumer<K,V> exceptionHandler(io.vertx.core.Handler<Throwable> handler)
exceptionHandler
in interface io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
exceptionHandler
in interface io.vertx.core.streams.StreamBase
KafkaConsumer<K,V> handler(io.vertx.core.Handler<KafkaConsumerRecord<K,V>> handler)
handler
in interface io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
KafkaConsumer<K,V> pause()
pause
in interface io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
KafkaConsumer<K,V> resume()
resume
in interface io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
KafkaConsumer<K,V> fetch(long amount)
fetch
in interface io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
KafkaConsumer<K,V> endHandler(io.vertx.core.Handler<Void> endHandler)
endHandler
in interface io.vertx.core.streams.ReadStream<KafkaConsumerRecord<K,V>>
long demand()
Long.MAX_VALUE
.
io.vertx.core.Future<Void> subscribe(String topic)
topic
- topic to subscribe toFuture
completed with the operation resultio.vertx.core.Future<Void> subscribe(Set<String> topics)
topics
- topics to subscribe toFuture
completed with the operation resultKafkaConsumer<K,V> subscribe(String topic, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages, when changing the subscribed topic
the old topic may remain in effect
(as observed by the handler(Handler) record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new topic.
topic
- topic to subscribe tocompletionHandler
- handler called on operation completedKafkaConsumer<K,V> subscribe(Set<String> topics, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages, when changing the subscribed topics
the old set of topics may remain in effect
(as observed by the handler(Handler) record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new set of topics.
topics
- topics to subscribe tocompletionHandler
- handler called on operation completedio.vertx.core.Future<Void> subscribe(Pattern pattern)
pattern
- Pattern to subscribe toFuture
completed with the operation resultKafkaConsumer<K,V> subscribe(Pattern pattern, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages, when changing the subscribed topics
the old set of topics may remain in effect
(as observed by the handler(Handler) record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new set of topics.
pattern
- Pattern to subscribe tocompletionHandler
- handler called on operation completedio.vertx.core.Future<Void> assign(TopicPartition topicPartition)
topicPartition
- partition which want assignedFuture
completed with the operation resultio.vertx.core.Future<Void> assign(Set<TopicPartition> topicPartitions)
topicPartitions
- partitions which want assignedFuture
completed with the operation resultKafkaConsumer<K,V> assign(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages, when reassigning
the old partition may remain in effect
(as observed by the handler(Handler) record handler)}
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new partition.
topicPartition
- partition which want assignedcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> assign(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages, when reassigning
the old set of partitions may remain in effect
(as observed by the handler(Handler) record handler)}
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new set of partitions.
topicPartitions
- partitions which want assignedcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> assignment(io.vertx.core.Handler<io.vertx.core.AsyncResult<Set<TopicPartition>>> handler)
handler
- handler called on operation completedio.vertx.core.Future<Set<TopicPartition>> assignment()
assignment(Handler)
but returns a Future
of the asynchronous resultKafkaConsumer<K,V> listTopics(io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<String,List<PartitionInfo>>>> handler)
handler
- handler called on operation completedio.vertx.core.Future<Map<String,List<PartitionInfo>>> listTopics()
listTopics(Handler)
but returns a Future
of the asynchronous resultio.vertx.core.Future<Void> unsubscribe()
Future
completed with the operation resultKafkaConsumer<K,V> unsubscribe(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
completionHandler
- handler called on operation completedKafkaConsumer<K,V> subscription(io.vertx.core.Handler<io.vertx.core.AsyncResult<Set<String>>> handler)
handler
- handler called on operation completedio.vertx.core.Future<Set<String>> subscription()
subscription(Handler)
but returns a Future
of the asynchronous resultio.vertx.core.Future<Void> pause(TopicPartition topicPartition)
topicPartition
- topic partition from which suspend fetchingFuture
completed with the operation resultio.vertx.core.Future<Void> pause(Set<TopicPartition> topicPartitions)
topicPartitions
- topic partition from which suspend fetchingFuture
completed with the operation resultKafkaConsumer<K,V> pause(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages from the given topicPartition
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will not see messages
from the given topicPartition
.
topicPartition
- topic partition from which suspend fetchingcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> pause(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages from the given topicPartitions
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will not see messages
from the given topicPartitions
.
topicPartitions
- topic partition from which suspend fetchingcompletionHandler
- handler called on operation completedvoid paused(io.vertx.core.Handler<io.vertx.core.AsyncResult<Set<TopicPartition>>> handler)
handler
- handler called on operation completedio.vertx.core.Future<Set<TopicPartition>> paused()
paused(Handler)
but returns a Future
of the asynchronous resultio.vertx.core.Future<Void> resume(TopicPartition topicPartition)
topicPartition
- topic partition from which resume fetchingFuture
completed with the operation resultio.vertx.core.Future<Void> resume(Set<TopicPartition> topicPartitions)
topicPartitions
- topic partition from which resume fetchingFuture
completed with the operation resultKafkaConsumer<K,V> resume(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
topicPartition
- topic partition from which resume fetchingcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> resume(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
topicPartitions
- topic partition from which resume fetchingcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> partitionsRevokedHandler(io.vertx.core.Handler<Set<TopicPartition>> handler)
handler
- handler called on revoked topic partitionsKafkaConsumer<K,V> partitionsAssignedHandler(io.vertx.core.Handler<Set<TopicPartition>> handler)
handler
- handler called on assigned topic partitionsio.vertx.core.Future<Void> seek(TopicPartition topicPartition, long offset)
topicPartition
- topic partition for which seekoffset
- offset to seek inside the topic partitionFuture
completed with the operation resultKafkaConsumer<K,V> seek(TopicPartition topicPartition, long offset, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new offset.
topicPartition
- topic partition for which seekoffset
- offset to seek inside the topic partitioncompletionHandler
- handler called on operation completedio.vertx.core.Future<Void> seekToBeginning(TopicPartition topicPartition)
topicPartition
- topic partition for which seekFuture
completed with the operation resultio.vertx.core.Future<Void> seekToBeginning(Set<TopicPartition> topicPartitions)
topicPartitions
- topic partition for which seekFuture
completed with the operation resultKafkaConsumer<K,V> seekToBeginning(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new offset.
topicPartition
- topic partition for which seekcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> seekToBeginning(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new offset.
topicPartitions
- topic partition for which seekcompletionHandler
- handler called on operation completedio.vertx.core.Future<Void> seekToEnd(TopicPartition topicPartition)
topicPartition
- topic partition for which seekFuture
completed with the operation resultio.vertx.core.Future<Void> seekToEnd(Set<TopicPartition> topicPartitions)
topicPartitions
- topic partition for which seekFuture
completed with the operation resultKafkaConsumer<K,V> seekToEnd(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new offset.
topicPartition
- topic partition for which seekcompletionHandler
- handler called on operation completedKafkaConsumer<K,V> seekToEnd(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
Due to internal buffering of messages,
the record handler will
continue to observe messages fetched with respect to the old offset
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the batchHandler(Handler)
will only see messages
consistent with the new offset.
topicPartitions
- topic partition for which seekcompletionHandler
- handler called on operation completedio.vertx.core.Future<Void> commit()
void commit(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
completionHandler
- handler called on operation completedio.vertx.core.Future<Map<TopicPartition,OffsetAndMetadata>> commit(Map<TopicPartition,OffsetAndMetadata> offsets)
offsets
- offsets list to commitvoid commit(Map<TopicPartition,OffsetAndMetadata> offsets, io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,OffsetAndMetadata>>> completionHandler)
offsets
- offsets list to commitcompletionHandler
- handler called on operation completedvoid committed(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<OffsetAndMetadata>> handler)
topicPartition
- topic partition for getting last committed offsethandler
- handler called on operation completedio.vertx.core.Future<OffsetAndMetadata> committed(TopicPartition topicPartition)
committed(TopicPartition, Handler)
but returns a Future
of the asynchronous resultKafkaConsumer<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 resultKafkaConsumer<K,V> batchHandler(io.vertx.core.Handler<KafkaConsumerRecords<K,V>> handler)
record handler
.handler
- handler called when batches of messages are fetchedio.vertx.core.Future<Void> close()
void close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> completionHandler)
completionHandler
- handler called on operation completedvoid position(TopicPartition partition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> handler)
partition
- The partition to get the position forhandler
- handler called on operation completedio.vertx.core.Future<Long> position(TopicPartition partition)
position(TopicPartition, Handler)
but returns a Future
of the asynchronous resultvoid offsetsForTimes(Map<TopicPartition,Long> topicPartitionTimestamps, io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,OffsetAndTimestamp>>> handler)
topicPartitionTimestamps
- A map with pairs of (TopicPartition, Timestamp).handler
- handler called on operation completedio.vertx.core.Future<Map<TopicPartition,OffsetAndTimestamp>> offsetsForTimes(Map<TopicPartition,Long> topicPartitionTimestamps)
offsetsForTimes(Map, Handler)
but returns a Future
of the asynchronous resultvoid offsetsForTimes(TopicPartition topicPartition, Long timestamp, io.vertx.core.Handler<io.vertx.core.AsyncResult<OffsetAndTimestamp>> handler)
topicPartition
- TopicPartition to query.timestamp
- Timestamp to be used in the query.handler
- handler called on operation completedio.vertx.core.Future<OffsetAndTimestamp> offsetsForTimes(TopicPartition topicPartition, Long timestamp)
offsetsForTimes(TopicPartition, Long, Handler)
but returns a Future
of the asynchronous resultvoid beginningOffsets(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,Long>>> handler)
topicPartitions
- the partitions to get the earliest offsets.handler
- handler called on operation completed. Returns the earliest available offsets for the given partitionsio.vertx.core.Future<Map<TopicPartition,Long>> beginningOffsets(Set<TopicPartition> topicPartitions)
beginningOffsets(Set, Handler)
but returns a Future
of the asynchronous resultvoid beginningOffsets(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> handler)
topicPartition
- the partition to get the earliest offset.handler
- handler called on operation completed. Returns the earliest available offset for the given partitionio.vertx.core.Future<Long> beginningOffsets(TopicPartition topicPartition)
beginningOffsets(TopicPartition, Handler)
but returns a Future
of the asynchronous resultvoid endOffsets(Set<TopicPartition> topicPartitions, io.vertx.core.Handler<io.vertx.core.AsyncResult<Map<TopicPartition,Long>>> handler)
topicPartitions
- the partitions to get the end offsets.handler
- handler called on operation completed. The end offsets for the given partitions.io.vertx.core.Future<Map<TopicPartition,Long>> endOffsets(Set<TopicPartition> topicPartitions)
endOffsets(Set, Handler)
but returns a Future
of the asynchronous resultvoid endOffsets(TopicPartition topicPartition, io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> handler)
topicPartition
- the partition to get the end offset.handler
- handler called on operation completed. The end offset for the given partition.io.vertx.core.Future<Long> endOffsets(TopicPartition topicPartition)
endOffsets(TopicPartition, Handler)
but returns a Future
of the asynchronous resultKafkaReadStream<K,V> asStream()
KafkaReadStream
instanceKafkaConsumer<K,V> pollTimeout(Duration timeout)
timeout
- The time, spent waiting in poll if data is not available in the buffer.
If 0, returns immediately with any records that are available currently in the native Kafka consumer's buffer,
else returns empty. Must not be negative.void poll(Duration timeout, io.vertx.core.Handler<io.vertx.core.AsyncResult<KafkaConsumerRecords<K,V>>> handler)
timeout
- The maximum time to block (must not be greater than Long.MAX_VALUE
milliseconds)handler
- handler called after the poll with batch of records (can be empty).io.vertx.core.Future<KafkaConsumerRecords<K,V>> poll(Duration timeout)
poll(Duration, Handler)
but returns a Future
of the asynchronous resultCopyright © 2020 Eclipse. All rights reserved.