public class ReactiveKafkaConsumer<K,V> extends Object implements KafkaConsumer<K,V>
| Constructor and Description |
|---|
ReactiveKafkaConsumer(KafkaConnectorIncomingConfiguration config,
KafkaSource<K,V> source) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
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
|
Map<String,?> |
configuration() |
String |
get(String attribute) |
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
|
void |
injectClient(org.apache.kafka.clients.consumer.MockConsumer<?,?> consumer) |
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.
|
<T> io.smallrye.mutiny.Uni<T> |
runOnPollingThread(Function<org.apache.kafka.clients.consumer.Consumer<K,V>,T> action)
Runs an action on the polling thread.
|
void |
setRebalanceListener() |
io.smallrye.mutiny.Multi<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> |
subscribe(Pattern topics) |
io.smallrye.mutiny.Multi<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> |
subscribe(Set<String> topics) |
org.apache.kafka.clients.consumer.Consumer<K,V> |
unwrap() |
public ReactiveKafkaConsumer(KafkaConnectorIncomingConfiguration config, KafkaSource<K,V> source)
public void setRebalanceListener()
public <T> io.smallrye.mutiny.Uni<T> runOnPollingThread(Function<org.apache.kafka.clients.consumer.Consumer<K,V>,T> action)
KafkaConsumer
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 KafkaConsumer.runOnPollingThread(Consumer).
runOnPollingThread in interface KafkaConsumer<K,V>T - the type of result, can be Voidaction - the action to execute, must not be nullpublic io.smallrye.mutiny.Uni<Void> runOnPollingThread(Consumer<org.apache.kafka.clients.consumer.Consumer<K,V>> action)
KafkaConsumer
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.
runOnPollingThread in interface KafkaConsumer<K,V>action - the action, must not be nullnull or the failure when the action completes.public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> pause()
KafkaConsumerpause in interface KafkaConsumer<K,V>public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> paused()
KafkaConsumerpaused in interface KafkaConsumer<K,V>public io.smallrye.mutiny.Uni<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>> committed(org.apache.kafka.common.TopicPartition... tps)
KafkaConsumercommitted in interface KafkaConsumer<K,V>tps - the set of topic/partition to query, must not be null, must not be empty.public io.smallrye.mutiny.Multi<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> subscribe(Set<String> topics)
public io.smallrye.mutiny.Multi<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> subscribe(Pattern topics)
public io.smallrye.mutiny.Uni<Void> resume()
KafkaConsumerresume in interface KafkaConsumer<K,V>public org.apache.kafka.clients.consumer.Consumer<K,V> unwrap()
unwrap in interface KafkaConsumer<K,V>public io.smallrye.mutiny.Uni<Void> commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> map)
KafkaConsumercommit in interface KafkaConsumer<K,V>map - the map of topic/partition -> offset to commitnull when the commit has been executed.public void close()
public void injectClient(org.apache.kafka.clients.consumer.MockConsumer<?,?> consumer)
public io.smallrye.mutiny.Uni<Map<org.apache.kafka.common.TopicPartition,Long>> getPositions()
KafkaConsumergetPositions in interface KafkaConsumer<K,V>public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> getAssignments()
KafkaConsumergetAssignments in interface KafkaConsumer<K,V>Copyright © 2018–2021 SmallRye. All rights reserved.