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.
|
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 using emits the exception as failure.
If the action does not return a result, use runOnPollingThread(Consumer)
.
R
- the type of result, can be Void
action
- the action to execute, must not be null
io.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 using emits the exception as failure.
action
- the action, must not be null
null
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()
Copyright © 2018–2021 SmallRye. All rights reserved.