K - the type of keyV - the type of valuepublic interface KafkaConsumer<K,V>
Unlike Consumer, this API is asynchronous and make sure that the actions are executed on the Kafka polling
thread.
| Modifier and Type | Method and Description |
|---|---|
io.smallrye.mutiny.Uni<Void> |
commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> map)
Commits the offsets
|
io.smallrye.mutiny.Uni<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> |
committed(org.apache.kafka.common.TopicPartition... tps)
Retrieved the last committed offset for each topic/partition
|
io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> |
getAssignments()
Retrieves the current assignments of the consumer.
|
io.smallrye.mutiny.Uni<Map<org.apache.kafka.common.TopicPartition,Long>> |
getPositions()
Retrieves the next positions for each assigned topic/partitions
|
io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> |
pause()
Pauses the consumption of records.
|
io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> |
paused()
Retrieves the set of paused topic/partition
|
io.smallrye.mutiny.Uni<Void> |
resume()
Resumes the consumption of record.
|
io.smallrye.mutiny.Uni<Void> |
runOnPollingThread(Consumer<org.apache.kafka.clients.consumer.Consumer<K,V>> action)
Runs an action on the polling thread.
|
<R> io.smallrye.mutiny.Uni<R> |
runOnPollingThread(Function<org.apache.kafka.clients.consumer.Consumer<K,V>,R> action)
Runs an action on the polling thread.
|
io.smallrye.mutiny.Uni<Void> |
seek(org.apache.kafka.common.TopicPartition partition,
long offset)
Overrides the fetch offset that the consumer will use on the next poll of given topic and partition.
|
io.smallrye.mutiny.Uni<Void> |
seek(org.apache.kafka.common.TopicPartition partition,
org.apache.kafka.clients.consumer.OffsetAndMetadata offsetAndMetadata)
Overrides the fetch offset that the consumer will use on the next poll of given topic and partition.
|
io.smallrye.mutiny.Uni<Void> |
seekToBeginning(Collection<org.apache.kafka.common.TopicPartition> partitions)
Seek to the first offset for each of the given partitions.
|
io.smallrye.mutiny.Uni<Void> |
seekToEnd(Collection<org.apache.kafka.common.TopicPartition> partitions)
Seek to the last offset for each of the given partitions.
|
org.apache.kafka.clients.consumer.Consumer<K,V> |
unwrap() |
<R> io.smallrye.mutiny.Uni<R> runOnPollingThread(Function<org.apache.kafka.clients.consumer.Consumer<K,V>,R> action)
The action is a function taking as parameter the Consumer and that returns a result (potentially null).
The produced Uni emits the returned result when the action completes. If the action throws an exception,
the produced Uni emits the exception as failure.
If the action does not return a result, use runOnPollingThread(java.util.function.Consumer).
R - the type of result, can be Voidaction - the action to execute, must not be nullio.smallrye.mutiny.Uni<Void> runOnPollingThread(Consumer<org.apache.kafka.clients.consumer.Consumer<K,V>> action)
The action is a consumer receiving the Consumer.
The produced Uni emits null when the action completes. If the action throws an exception,
the produced Uni emits the exception as failure.
action - the action, must not be nullnull or the failure when the action completes.io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> pause()
io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> paused()
io.smallrye.mutiny.Uni<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> committed(org.apache.kafka.common.TopicPartition... tps)
tps - the set of topic/partition to query, must not be null, must not be empty.io.smallrye.mutiny.Uni<Void> resume()
org.apache.kafka.clients.consumer.Consumer<K,V> unwrap()
io.smallrye.mutiny.Uni<Void> commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> map)
map - the map of topic/partition -> offset to commitnull when the commit has been executed.io.smallrye.mutiny.Uni<Map<org.apache.kafka.common.TopicPartition,Long>> getPositions()
io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> getAssignments()
io.smallrye.mutiny.Uni<Void> seek(org.apache.kafka.common.TopicPartition partition, long offset)
partition - the topic and partition for which to set the offsetoffset - the new offsetIllegalArgumentException if the provided offset is negative;
it completes with IllegalStateException if the provided TopicPartition is not assigned to this
consumerio.smallrye.mutiny.Uni<Void> seek(org.apache.kafka.common.TopicPartition partition, org.apache.kafka.clients.consumer.OffsetAndMetadata offsetAndMetadata)
partition - the topic and partition for which to set the offsetoffsetAndMetadata - the new offset, with additional metadataIllegalArgumentException if the provided offset is negative;
it completes with IllegalStateException if the provided TopicPartition is not assigned to this
consumerio.smallrye.mutiny.Uni<Void> seekToBeginning(Collection<org.apache.kafka.common.TopicPartition> partitions)
partitions - the partitions for which to set the offsetIllegalArgumentException if partitions is null;
it completes with IllegalStateException if any of the provided TopicPartitions are not currently
assigned to this consumerio.smallrye.mutiny.Uni<Void> seekToEnd(Collection<org.apache.kafka.common.TopicPartition> partitions)
partitions - the partitions for which to set the offsetIllegalArgumentException if partitions is null;
it completes with IllegalStateException if any of the provided TopicPartitions are not currently
assigned to this consumerCopyright © 2018–2021 SmallRye. All rights reserved.