public class KafkaReadStreamImpl<K,V> extends Object implements KafkaReadStream<K,V>
| Constructor and Description |
|---|
KafkaReadStreamImpl(Vertx vertx,
org.apache.kafka.clients.consumer.Consumer<K,V> consumer,
KafkaClientOptions options) |
| Modifier and Type | Method and Description |
|---|---|
Future<Void> |
assign(Set<org.apache.kafka.common.TopicPartition> partitions)
Manually assign a set of partitions to this consumer.
|
KafkaReadStream<K,V> |
assign(Set<org.apache.kafka.common.TopicPartition> partitions,
Handler<AsyncResult<Void>> completionHandler)
Manually assign a set of partitions to this consumer.
|
Future<Set<org.apache.kafka.common.TopicPartition>> |
assignment()
Like
KafkaReadStream.assignment(Handler) but returns a Future of the asynchronous result |
KafkaReadStream<K,V> |
assignment(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
Get the set of partitions currently assigned to this consumer.
|
KafkaReadStream |
batchHandler(Handler<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> handler)
Set the handler that will be called when a new batch of records is
returned from Kafka.
|
Future<Map<org.apache.kafka.common.TopicPartition,Long>> |
beginningOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
Like
KafkaReadStream.beginningOffsets(Set, Handler) but returns a Future of the asynchronous result |
void |
beginningOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)
Get the first offset for the given partitions.
|
Future<Long> |
beginningOffsets(org.apache.kafka.common.TopicPartition topicPartition)
Like
KafkaReadStream.beginningOffsets(TopicPartition, Handler) but returns a Future of the asynchronous result |
void |
beginningOffsets(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<Long>> handler)
Get the first offset for the given partition.
|
Future<Void> |
close()
Close the stream
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the stream
|
Future<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> |
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.
|
Future<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> |
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.
|
Future<org.apache.kafka.clients.consumer.OffsetAndMetadata> |
committed(org.apache.kafka.common.TopicPartition topicPartition)
Like
KafkaReadStream.committed(TopicPartition, Handler) but returns a Future of the asynchronous result |
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).
|
long |
demand()
Returns the current demand.
|
KafkaReadStreamImpl<K,V> |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
Future<Map<org.apache.kafka.common.TopicPartition,Long>> |
endOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
Like
KafkaReadStream.endOffsets(Set, Handler) but returns a Future of the asynchronous result |
void |
endOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)
Get the last offset for the given partitions.
|
Future<Long> |
endOffsets(org.apache.kafka.common.TopicPartition topicPartition)
Like
KafkaReadStream.endOffsets(TopicPartition, Handler) but returns a Future of the asynchronous result |
void |
endOffsets(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<Long>> handler)
Get the last offset for the given partition.
|
KafkaReadStreamImpl<K,V> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
KafkaReadStreamImpl<K,V> |
fetch(long amount)
Fetch the specified
amount of elements. |
KafkaReadStreamImpl<K,V> |
handler(Handler<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> handler)
Set a data handler.
|
Future<Map<String,List<org.apache.kafka.common.PartitionInfo>>> |
listTopics()
Like
KafkaReadStream.listTopics(Handler) but returns a Future of the asynchronous result |
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.
|
Future<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp>> |
offsetsForTimes(Map<org.apache.kafka.common.TopicPartition,Long> topicPartitionTimestamps)
Like
KafkaReadStream.offsetsForTimes(Map, Handler) but returns a Future of the asynchronous result |
void |
offsetsForTimes(Map<org.apache.kafka.common.TopicPartition,Long> topicPartitionTimestamps,
Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp>>> handler)
Look up the offsets for the given partitions by timestamp.
|
Future<org.apache.kafka.clients.consumer.OffsetAndTimestamp> |
offsetsForTimes(org.apache.kafka.common.TopicPartition topicPartition,
long timestamp)
Like
KafkaReadStream.offsetsForTimes(TopicPartition, long, Handler) but returns a Future of the asynchronous result |
void |
offsetsForTimes(org.apache.kafka.common.TopicPartition topicPartition,
long timestamp,
Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndTimestamp>> handler)
* Look up the offset for the given partition by timestamp.
|
KafkaReadStream<K,V> |
partitionsAssignedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
Set the handler called when topic partitions are assigned to the consumer
|
Future<List<org.apache.kafka.common.PartitionInfo>> |
partitionsFor(String topic)
Like
KafkaReadStream.partitionsFor(String, Handler) but returns a Future of the asynchronous result |
KafkaReadStreamImpl<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
|
KafkaReadStreamImpl<K,V> |
pause()
Pause the
ReadStream, it sets the buffer in fetch mode and clears the actual demand. |
Future<Void> |
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.
|
Future<Set<org.apache.kafka.common.TopicPartition>> |
paused()
Like
KafkaReadStream.paused(Handler) but returns a Future of the asynchronous result |
void |
paused(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
Get the set of partitions that were previously paused by a call to
KafkaReadStream.pause(Set). |
Future<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> |
poll(Duration timeout)
Like
KafkaReadStream.poll(Duration, Handler) but returns a Future of the asynchronous result |
void |
poll(Duration timeout,
Handler<AsyncResult<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>> handler)
Executes a poll for getting messages from Kafka.
|
KafkaReadStream<K,V> |
pollTimeout(Duration timeout)
Sets the poll timeout for the underlying native Kafka Consumer.
|
Future<Long> |
position(org.apache.kafka.common.TopicPartition partition)
Like
KafkaReadStream.position(TopicPartition, Handler) but returns a Future of the asynchronous result |
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).
|
KafkaReadStreamImpl<K,V> |
resume()
Resume reading, and sets the buffer in
flowing mode. |
Future<Void> |
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.
|
Future<Void> |
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.
|
Future<Void> |
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.
|
Future<Void> |
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.
|
protected <T> void |
submitTask(BiConsumer<org.apache.kafka.clients.consumer.Consumer<K,V>,Promise<T>> task,
Handler<AsyncResult<T>> handler) |
Future<Void> |
subscribe(Pattern pattern)
Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
|
KafkaReadStream<K,V> |
subscribe(Pattern pattern,
Handler<AsyncResult<Void>> completionHandler)
Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
|
Future<Void> |
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.
|
Future<Set<String>> |
subscription()
Like
KafkaReadStream.subscription(Handler) but returns a Future of the asynchronous result |
KafkaReadStream<K,V> |
subscription(Handler<AsyncResult<Set<String>>> handler)
Get the current subscription.
|
Future<Void> |
unsubscribe()
Unsubscribe from topics currently subscribed with subscribe.
|
KafkaReadStream<K,V> |
unsubscribe(Handler<AsyncResult<Void>> completionHandler)
Unsubscribe from topics currently subscribed with subscribe.
|
org.apache.kafka.clients.consumer.Consumer<K,V> |
unwrap() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, create, create, create, create, create, create, create, createpipe, pipeTo, pipeTopublic KafkaReadStreamImpl(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer, KafkaClientOptions options)
protected <T> void submitTask(BiConsumer<org.apache.kafka.clients.consumer.Consumer<K,V>,Promise<T>> task, Handler<AsyncResult<T>> handler)
public Future<Void> pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
KafkaReadStreampause in interface KafkaReadStream<K,V>topicPartitions - topic partition from which suspend fetchingFuture completed with the operation resultpublic KafkaReadStream<K,V> pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
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 KafkaReadStream.batchHandler(Handler) will not see messages
from the given topicPartitions.
pause in interface KafkaReadStream<K,V>topicPartitions - topic partition from which suspend fetchingcompletionHandler - handler called on operation completedpublic void paused(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
KafkaReadStreamKafkaReadStream.pause(Set).paused in interface KafkaReadStream<K,V>handler - handler called on operation completedpublic Future<Set<org.apache.kafka.common.TopicPartition>> paused()
KafkaReadStreamKafkaReadStream.paused(Handler) but returns a Future of the asynchronous resultpaused in interface KafkaReadStream<K,V>public Future<Void> resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
KafkaReadStreamresume in interface KafkaReadStream<K,V>topicPartitions - topic partition from which resume fetchingFuture completed with the operation resultpublic KafkaReadStream<K,V> resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStreamresume in interface KafkaReadStream<K,V>topicPartitions - topic partition from which resume fetchingcompletionHandler - handler called on operation completedpublic void committed(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndMetadata>> handler)
KafkaReadStreamcommitted in interface KafkaReadStream<K,V>topicPartition - topic partition for getting last committed offsethandler - handler called on operation completedpublic Future<org.apache.kafka.clients.consumer.OffsetAndMetadata> committed(org.apache.kafka.common.TopicPartition topicPartition)
KafkaReadStreamKafkaReadStream.committed(TopicPartition, Handler) but returns a Future of the asynchronous resultcommitted in interface KafkaReadStream<K,V>public Future<Void> seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
KafkaReadStreamseekToEnd in interface KafkaReadStream<K,V>topicPartitions - topic partition for which seekFuture completed with the operation resultpublic KafkaReadStream<K,V> seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
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 KafkaReadStream.batchHandler(Handler) will only see messages
consistent with the new offset.
seekToEnd in interface KafkaReadStream<K,V>topicPartitions - topic partition for which seekcompletionHandler - handler called on operation completedpublic Future<Void> seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
KafkaReadStreamseekToBeginning in interface KafkaReadStream<K,V>topicPartitions - topic partition for which seekFuture completed with the operation resultpublic KafkaReadStream<K,V> seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
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 KafkaReadStream.batchHandler(Handler) will only see messages
consistent with the new offset.
seekToBeginning in interface KafkaReadStream<K,V>topicPartitions - topic partition for which seekcompletionHandler - handler called on operation completedpublic Future<Void> seek(org.apache.kafka.common.TopicPartition topicPartition, long offset)
KafkaReadStreamseek in interface KafkaReadStream<K,V>topicPartition - topic partition for which seekoffset - offset to seek inside the topic partitionFuture completed with the operation resultpublic KafkaReadStream<K,V> seek(org.apache.kafka.common.TopicPartition topicPartition, long offset, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
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 KafkaReadStream.batchHandler(Handler) will only see messages
consistent with the new offset.
seek in interface KafkaReadStream<K,V>topicPartition - topic partition for which seekoffset - offset to seek inside the topic partitioncompletionHandler - handler called on operation completedpublic KafkaReadStream<K,V> partitionsRevokedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
KafkaReadStreampartitionsRevokedHandler in interface KafkaReadStream<K,V>handler - handler called on revoked topic partitionspublic KafkaReadStream<K,V> partitionsAssignedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)
KafkaReadStreampartitionsAssignedHandler in interface KafkaReadStream<K,V>handler - handler called on assigned topic partitionspublic Future<Void> subscribe(Set<String> topics)
KafkaReadStreamsubscribe in interface KafkaReadStream<K,V>topics - topics to subscribe toFuture completed with the operation resultpublic KafkaReadStream<K,V> subscribe(Set<String> topics, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
Due to internal buffering of messages, when changing the subscribed topics
the old set of topics may remain in effect
(as observed by the KafkaReadStream.handler(Handler) record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the KafkaReadStream.batchHandler(Handler) will only see messages
consistent with the new set of topics.
subscribe in interface KafkaReadStream<K,V>topics - topics to subscribe tocompletionHandler - handler called on operation completedpublic KafkaReadStream<K,V> subscribe(Pattern pattern, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
Due to internal buffering of messages, when changing the subscribed topics
the old set of topics may remain in effect
(as observed by the KafkaReadStream.handler(Handler) record handler})
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the KafkaReadStream.batchHandler(Handler) will only see messages
consistent with the new set of topics.
subscribe in interface KafkaReadStream<K,V>pattern - Pattern to subscribe tocompletionHandler - handler called on operation completedpublic Future<Void> subscribe(Pattern pattern)
KafkaReadStreamsubscribe in interface KafkaReadStream<K,V>pattern - Pattern to subscribe toFuture completed with the operation resultpublic Future<Void> unsubscribe()
KafkaReadStreamunsubscribe in interface KafkaReadStream<K,V>public KafkaReadStream<K,V> unsubscribe(Handler<AsyncResult<Void>> completionHandler)
KafkaReadStreamunsubscribe in interface KafkaReadStream<K,V>completionHandler - handler called on operation completedpublic KafkaReadStream<K,V> subscription(Handler<AsyncResult<Set<String>>> handler)
KafkaReadStreamsubscription in interface KafkaReadStream<K,V>handler - handler called on operation completedpublic Future<Set<String>> subscription()
KafkaReadStreamKafkaReadStream.subscription(Handler) but returns a Future of the asynchronous resultsubscription in interface KafkaReadStream<K,V>public Future<Void> assign(Set<org.apache.kafka.common.TopicPartition> partitions)
KafkaReadStreamassign in interface KafkaReadStream<K,V>partitions - partitions which want assignedpublic KafkaReadStream<K,V> assign(Set<org.apache.kafka.common.TopicPartition> partitions, Handler<AsyncResult<Void>> completionHandler)
KafkaReadStream
Due to internal buffering of messages, when reassigning
the old set of partitions may remain in effect
(as observed by the KafkaReadStream.handler(Handler) record handler)}
until some time after the given completionHandler
is called. In contrast, the once the given completionHandler
is called the KafkaReadStream.batchHandler(Handler) will only see messages
consistent with the new set of partitions.
assign in interface KafkaReadStream<K,V>partitions - partitions which want assignedcompletionHandler - handler called on operation completedpublic KafkaReadStream<K,V> assignment(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)
KafkaReadStreamassignment in interface KafkaReadStream<K,V>handler - handler called on operation completedpublic Future<Set<org.apache.kafka.common.TopicPartition>> assignment()
KafkaReadStreamKafkaReadStream.assignment(Handler) but returns a Future of the asynchronous resultassignment in interface KafkaReadStream<K,V>public KafkaReadStream<K,V> listTopics(Handler<AsyncResult<Map<String,List<org.apache.kafka.common.PartitionInfo>>>> handler)
KafkaReadStreamlistTopics in interface KafkaReadStream<K,V>handler - handler called on operation completedpublic Future<Map<String,List<org.apache.kafka.common.PartitionInfo>>> listTopics()
KafkaReadStreamKafkaReadStream.listTopics(Handler) but returns a Future of the asynchronous resultlistTopics in interface KafkaReadStream<K,V>public Future<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> commit()
KafkaReadStreamcommit in interface KafkaReadStream<K,V>public void commit(Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)
KafkaReadStreamcommit in interface KafkaReadStream<K,V>completionHandler - handler called on operation completedpublic Future<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets)
KafkaReadStreamcommit in interface KafkaReadStream<K,V>offsets - offsets list to commitFuture completed with the operation resultpublic 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)
KafkaReadStreamcommit in interface KafkaReadStream<K,V>offsets - offsets list to commitcompletionHandler - handler called on operation completedpublic KafkaReadStreamImpl<K,V> partitionsFor(String topic, Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)
KafkaReadStreampartitionsFor in interface KafkaReadStream<K,V>topic - topic partition for which getting partitions infohandler - handler called on operation completedpublic Future<List<org.apache.kafka.common.PartitionInfo>> partitionsFor(String topic)
KafkaReadStreamKafkaReadStream.partitionsFor(String, Handler) but returns a Future of the asynchronous resultpartitionsFor in interface KafkaReadStream<K,V>public KafkaReadStreamImpl<K,V> exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>exceptionHandler in interface StreamBaseexceptionHandler in interface KafkaReadStream<K,V>handler - the exception handlerpublic KafkaReadStreamImpl<K,V> handler(Handler<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> handler)
ReadStreamhandler in interface ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>handler in interface KafkaReadStream<K,V>public KafkaReadStreamImpl<K,V> pause()
ReadStreamReadStream, it sets the buffer in fetch mode and clears the actual demand.
While it's paused, no data will be sent to the data handler.
pause in interface ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>pause in interface KafkaReadStream<K,V>public KafkaReadStreamImpl<K,V> resume()
ReadStreamflowing mode.
If the ReadStream has been paused, reading will recommence on it.resume in interface ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>resume in interface KafkaReadStream<K,V>public KafkaReadStreamImpl<K,V> fetch(long amount)
ReadStreamamount of elements. If the ReadStream has been paused, reading will
recommence with the specified amount of items, otherwise the specified amount will
be added to the current stream demand.fetch in interface ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>fetch in interface KafkaReadStream<K,V>public long demand()
KafkaReadStreamLong.MAX_VALUE.
demand in interface KafkaReadStream<K,V>public KafkaReadStreamImpl<K,V> endHandler(Handler<Void> endHandler)
ReadStreamendHandler in interface ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>endHandler in interface KafkaReadStream<K,V>public Future<Void> close()
KafkaReadStreamclose in interface KafkaReadStream<K,V>Future completed with the operation resultpublic void close(Handler<AsyncResult<Void>> completionHandler)
KafkaReadStreamclose in interface KafkaReadStream<K,V>completionHandler - handler called on operation completedpublic void position(org.apache.kafka.common.TopicPartition partition,
Handler<AsyncResult<Long>> handler)
KafkaReadStreamposition in interface KafkaReadStream<K,V>partition - The partition to get the position forhandler - handler called on operation completedpublic Future<Long> position(org.apache.kafka.common.TopicPartition partition)
KafkaReadStreamKafkaReadStream.position(TopicPartition, Handler) but returns a Future of the asynchronous resultposition in interface KafkaReadStream<K,V>public void offsetsForTimes(Map<org.apache.kafka.common.TopicPartition,Long> topicPartitionTimestamps, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp>>> handler)
KafkaReadStreamoffsetsForTimes in interface KafkaReadStream<K,V>topicPartitionTimestamps - A map with pairs of (TopicPartition, Timestamp).handler - handler called on operation completedpublic Future<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp>> offsetsForTimes(Map<org.apache.kafka.common.TopicPartition,Long> topicPartitionTimestamps)
KafkaReadStreamKafkaReadStream.offsetsForTimes(Map, Handler) but returns a Future of the asynchronous resultoffsetsForTimes in interface KafkaReadStream<K,V>public void offsetsForTimes(org.apache.kafka.common.TopicPartition topicPartition,
long timestamp,
Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndTimestamp>> handler)
KafkaReadStreamoffsetsForTimes in interface KafkaReadStream<K,V>topicPartition - Partition to query.timestamp - Timestamp used to determine the offset.handler - handler called on operation completedpublic Future<org.apache.kafka.clients.consumer.OffsetAndTimestamp> offsetsForTimes(org.apache.kafka.common.TopicPartition topicPartition, long timestamp)
KafkaReadStreamKafkaReadStream.offsetsForTimes(TopicPartition, long, Handler) but returns a Future of the asynchronous resultoffsetsForTimes in interface KafkaReadStream<K,V>public void beginningOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)
KafkaReadStreambeginningOffsets in interface KafkaReadStream<K,V>topicPartitions - the partitions to get the earliest offsets.handler - handler called on operation completed. Returns the earliest available offsets for the given partitionspublic Future<Map<org.apache.kafka.common.TopicPartition,Long>> beginningOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
KafkaReadStreamKafkaReadStream.beginningOffsets(Set, Handler) but returns a Future of the asynchronous resultbeginningOffsets in interface KafkaReadStream<K,V>public void beginningOffsets(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<Long>> handler)
KafkaReadStreambeginningOffsets in interface KafkaReadStream<K,V>topicPartition - the partition to get the earliest offset.handler - handler called on operation completed. Returns the earliest available offset for the given partitionpublic Future<Long> beginningOffsets(org.apache.kafka.common.TopicPartition topicPartition)
KafkaReadStreamKafkaReadStream.beginningOffsets(TopicPartition, Handler) but returns a Future of the asynchronous resultbeginningOffsets in interface KafkaReadStream<K,V>public void endOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)
KafkaReadStreamendOffsets in interface KafkaReadStream<K,V>topicPartitions - the partitions to get the end offsets.handler - handler called on operation completed. The end offsets for the given partitions.public Future<Map<org.apache.kafka.common.TopicPartition,Long>> endOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions)
KafkaReadStreamKafkaReadStream.endOffsets(Set, Handler) but returns a Future of the asynchronous resultendOffsets in interface KafkaReadStream<K,V>public void endOffsets(org.apache.kafka.common.TopicPartition topicPartition,
Handler<AsyncResult<Long>> handler)
KafkaReadStreamendOffsets in interface KafkaReadStream<K,V>topicPartition - the partition to get the end offset.handler - handler called on operation completed. The end offset for the given partition.public Future<Long> endOffsets(org.apache.kafka.common.TopicPartition topicPartition)
KafkaReadStreamKafkaReadStream.endOffsets(TopicPartition, Handler) but returns a Future of the asynchronous resultendOffsets in interface KafkaReadStream<K,V>public org.apache.kafka.clients.consumer.Consumer<K,V> unwrap()
unwrap in interface KafkaReadStream<K,V>public KafkaReadStream batchHandler(Handler<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> handler)
KafkaReadStreamrecord handler.batchHandler in interface KafkaReadStream<K,V>handler - handler called each time Kafka returns a batch of records.public KafkaReadStream<K,V> pollTimeout(Duration timeout)
KafkaReadStreampollTimeout in interface KafkaReadStream<K,V>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.public void poll(Duration timeout, Handler<AsyncResult<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>> handler)
KafkaReadStreampoll in interface KafkaReadStream<K,V>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).public Future<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> poll(Duration timeout)
KafkaReadStreamKafkaReadStream.poll(Duration, Handler) but returns a Future of the asynchronous resultpoll in interface KafkaReadStream<K,V>Copyright © 2021. All rights reserved.