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 Void
action
- the action to execute, must not be null
public 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 null
null
or the failure when the action completes.public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> pause()
KafkaConsumer
pause
in interface KafkaConsumer<K,V>
public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> paused()
KafkaConsumer
paused
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)
KafkaConsumer
committed
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()
KafkaConsumer
resume
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)
KafkaConsumer
commit
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()
KafkaConsumer
getPositions
in interface KafkaConsumer<K,V>
public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> getAssignments()
KafkaConsumer
getAssignments
in interface KafkaConsumer<K,V>
Copyright © 2018–2021 SmallRye. All rights reserved.