public interface KafkaReadStream<K,V> extends ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
ReadStream for consuming Kafka ConsumerRecord.
The ReadStream.pause() and ReadStream.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 |
|---|---|
KafkaReadStream<K,V> |
assign(Set<org.apache.kafka.common.TopicPartition> partitions)
Manually assign a list of partition to this consumer.
|
KafkaReadStream<K,V> |
assign(Set<org.apache.kafka.common.TopicPartition> partitions,
Handler<AsyncResult<Void>> completionHandler)
Manually assign a list of partition to this consumer.
|
KafkaReadStream<K,V> |
assignment(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
Get the set of partitions currently assigned to this consumer.
|
default void |
close()
Close the stream
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the stream
|
void |
commit()
Commit current offsets for all the subscribed list of topics and partition.
|
void |
commit(Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)
Commit current offsets for all the subscribed list of topics and partition.
|
void |
commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets)
Commit the specified offsets for the specified list of topics and partitions to Kafka.
|
void |
commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets,
Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)
Commit the specified offsets for the specified list of topics and partitions to Kafka.
|
void |
committed(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndMetadata>> handler)
Get the last committed offset for the given partition (whether the commit happened by this process or another).
|
org.apache.kafka.clients.consumer.Consumer<K,V> |
consumer() |
static <K,V> KafkaReadStream<K,V> |
create(Vertx vertx,
org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
Create a new KafkaReadStream instance
|
static <K,V> KafkaReadStream<K,V> |
create(Vertx vertx,
Map<String,Object> config)
Create a new KafkaReadStream instance
|
static <K,V> KafkaReadStream<K,V> |
create(Vertx vertx,
Map<String,Object> config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaReadStream instance
|
static <K,V> KafkaReadStream<K,V> |
create(Vertx vertx,
Properties config)
Create a new KafkaReadStream instance
|
static <K,V> KafkaReadStream<K,V> |
create(Vertx vertx,
Properties config,
Class<K> keyType,
Class<V> valueType)
Create a new KafkaReadStream instance
|
KafkaReadStream<K,V> |
listTopics(Handler<AsyncResult<Map<String,List<org.apache.kafka.common.PartitionInfo>>>> handler)
Get metadata about partitions for all topics that the user is authorized to view.
|
KafkaReadStream<K,V> |
partitionsAssignedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
Set the handler called when topic partitions are assigned to the consumer
|
KafkaReadStream<K,V> |
partitionsFor(String topic,
Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
Get metadata about the partitions for a given topic.
|
KafkaReadStream<K,V> |
partitionsRevokedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
Set the handler called when topic partitions are revoked to the consumer
|
KafkaReadStream<K,V> |
pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
Suspend fetching from the requested partitions.
|
KafkaReadStream<K,V> |
pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
Handler<AsyncResult<Void>> completionHandler)
Suspend fetching from the requested partitions.
|
void |
paused(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
Get the set of partitions that were previously paused by a call to
pause(Set). |
void |
position(org.apache.kafka.common.TopicPartition partition,
Handler<AsyncResult<Long>> handler)
Get the offset of the next record that will be fetched (if a record with that offset exists).
|
KafkaReadStream<K,V> |
resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
Resume specified partitions which have been paused with pause.
|
KafkaReadStream<K,V> |
resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
Handler<AsyncResult<Void>> completionHandler)
Resume specified partitions which have been paused with pause.
|
KafkaReadStream<K,V> |
seek(org.apache.kafka.common.TopicPartition topicPartition,
long offset)
Overrides the fetch offsets that the consumer will use on the next poll.
|
KafkaReadStream<K,V> |
seek(org.apache.kafka.common.TopicPartition topicPartition,
long offset,
Handler<AsyncResult<Void>> completionHandler)
Overrides the fetch offsets that the consumer will use on the next poll.
|
KafkaReadStream<K,V> |
seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
Seek to the first offset for each of the given partitions.
|
KafkaReadStream<K,V> |
seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
Handler<AsyncResult<Void>> completionHandler)
Seek to the first offset for each of the given partitions.
|
KafkaReadStream<K,V> |
seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
Seek to the last offset for each of the given partitions.
|
KafkaReadStream<K,V> |
seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
Handler<AsyncResult<Void>> completionHandler)
Seek to the last offset for each of the given partitions.
|
KafkaReadStream<K,V> |
subscribe(Set<String> topics)
Subscribe to the given list of topics to get dynamically assigned partitions.
|
KafkaReadStream<K,V> |
subscribe(Set<String> topics,
Handler<AsyncResult<Void>> completionHandler)
Subscribe to the given list of topics to get dynamically assigned partitions.
|
KafkaReadStream<K,V> |
subscription(Handler<AsyncResult<Set<String>>> handler)
Get the current subscription.
|
KafkaReadStream<K,V> |
unsubscribe()
Unsubscribe from topics currently subscribed with subscribe.
|
KafkaReadStream<K,V> |
unsubscribe(Handler<AsyncResult<Void>> completionHandler)
Unsubscribe from topics currently subscribed with subscribe.
|
endHandler, exceptionHandler, handler, pause, resumestatic <K,V> KafkaReadStream<K,V> create(Vertx vertx, Properties config)
vertx - Vert.x instance to useconfig - Kafka consumer configurationstatic <K,V> KafkaReadStream<K,V> create(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> KafkaReadStream<K,V> create(Vertx vertx, Map<String,Object> config)
vertx - Vert.x instance to useconfig - Kafka consumer configurationstatic <K,V> KafkaReadStream<K,V> create(Vertx vertx, Map<String,Object> 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> KafkaReadStream<K,V> create(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
vertx - Vert.x instance to useconsumer - native Kafka consumer instancevoid committed(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndMetadata>> handler)
topicPartition - topic partition for getting last committed offsethandler - handler called on operation completedKafkaReadStream<K,V> pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
topicPartitions - topic partition from which suspend fetchingKafkaReadStream<K,V> pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
topicPartitions - topic partition from which suspend fetchingcompletionHandler - handler called on operation completedvoid paused(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
pause(Set).handler - handler called on operation completedKafkaReadStream<K,V> resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
topicPartitions - topic partition from which resume fetchingKafkaReadStream<K,V> resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
topicPartitions - topic partition from which resume fetchingcompletionHandler - handler called on operation completedKafkaReadStream<K,V> seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
topicPartitions - topic partition for which seekKafkaReadStream<K,V> seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
topicPartitions - topic partition for which seekcompletionHandler - handler called on operation completedKafkaReadStream<K,V> seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
topicPartitions - topic partition for which seekKafkaReadStream<K,V> seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
topicPartitions - topic partition for which seekcompletionHandler - handler called on operation completedKafkaReadStream<K,V> seek(org.apache.kafka.common.TopicPartition topicPartition, long offset)
topicPartition - topic partition for which seekoffset - offset to seek inside the topic partitionKafkaReadStream<K,V> seek(org.apache.kafka.common.TopicPartition topicPartition, long offset, Handler<AsyncResult<Void>> completionHandler)
topicPartition - topic partition for which seekoffset - offset to seek inside the topic partitioncompletionHandler - handler called on operation completedKafkaReadStream<K,V> partitionsRevokedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
handler - handler called on revoked topic partitionsKafkaReadStream<K,V> partitionsAssignedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
handler - handler called on assigned topic partitionsKafkaReadStream<K,V> subscribe(Set<String> topics)
topics - topics to subscribe toKafkaReadStream<K,V> subscribe(Set<String> topics, Handler<AsyncResult<Void>> completionHandler)
topics - topics to subscribe tocompletionHandler - handler called on operation completedKafkaReadStream<K,V> unsubscribe()
KafkaReadStream<K,V> unsubscribe(Handler<AsyncResult<Void>> completionHandler)
completionHandler - handler called on operation completedKafkaReadStream<K,V> subscription(Handler<AsyncResult<Set<String>>> handler)
handler - handler called on operation completedKafkaReadStream<K,V> assign(Set<org.apache.kafka.common.TopicPartition> partitions)
partitions - partitions which want assignedKafkaReadStream<K,V> assign(Set<org.apache.kafka.common.TopicPartition> partitions, Handler<AsyncResult<Void>> completionHandler)
partitions - partitions which want assignedcompletionHandler - handler called on operation completedKafkaReadStream<K,V> assignment(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
handler - handler called on operation completedKafkaReadStream<K,V> listTopics(Handler<AsyncResult<Map<String,List<org.apache.kafka.common.PartitionInfo>>>> handler)
handler - handler called on operation completedvoid commit()
void commit(Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)
completionHandler - handler called on operation completedvoid commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets)
offsets - offsets list to commitvoid commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)
offsets - offsets list to commitcompletionHandler - handler called on operation completedKafkaReadStream<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 completeddefault void close()
void close(Handler<AsyncResult<Void>> completionHandler)
completionHandler - handler called on operation completedvoid position(org.apache.kafka.common.TopicPartition partition,
Handler<AsyncResult<Long>> handler)
partition - The partition to get the position forhandler - handler called on operation completedCopyright © 2017. All rights reserved.