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.
|
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.
|
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 Uni emits the exception as failure.
If the action does not return a result, use KafkaConsumer.runOnPollingThread(java.util.function.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 Uni 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>public io.smallrye.mutiny.Uni<Void> seek(org.apache.kafka.common.TopicPartition partition, long offset)
KafkaConsumerseek in interface KafkaConsumer<K,V>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
consumerpublic io.smallrye.mutiny.Uni<Void> seek(org.apache.kafka.common.TopicPartition partition, org.apache.kafka.clients.consumer.OffsetAndMetadata offsetAndMetadata)
KafkaConsumerseek in interface KafkaConsumer<K,V>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
consumerpublic io.smallrye.mutiny.Uni<Void> seekToBeginning(Collection<org.apache.kafka.common.TopicPartition> partitions)
KafkaConsumerseekToBeginning in interface KafkaConsumer<K,V>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 consumerpublic io.smallrye.mutiny.Uni<Void> seekToEnd(Collection<org.apache.kafka.common.TopicPartition> partitions)
KafkaConsumerseekToEnd in interface KafkaConsumer<K,V>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.