Class KafkaConsumer<K,V>
- java.lang.Object
-
- io.vertx.mutiny.kafka.client.consumer.KafkaConsumer<K,V>
-
- All Implemented Interfaces:
ReadStream<KafkaConsumerRecord<K,V>>
,StreamBase
public class KafkaConsumer<K,V> extends Object implements ReadStream<KafkaConsumerRecord<K,V>>
Vert.x Kafka consumer.You receive Kafka records by providing a
handler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecord<K, V>>)
. As messages arrive the handler will be called with the records.The
pause()
andresume()
provides global control over reading the records from the consumer.The
NOTE: This class has been automatically generated from thepause()
andresume()
provides finer grained control over reading records for specific Topic/Partition, these are Kafka's specific operations.original
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<KafkaConsumer>
__TYPE_ARG
TypeArg<K>
__typeArg_0
TypeArg<V>
__typeArg_1
-
Constructor Summary
Constructors Constructor Description KafkaConsumer(io.vertx.kafka.client.consumer.KafkaConsumer delegate)
KafkaConsumer(io.vertx.kafka.client.consumer.KafkaConsumer delegate, TypeArg<K> typeArg_0, TypeArg<V> typeArg_1)
KafkaConsumer(Object delegate, TypeArg<K> typeArg_0, TypeArg<V> typeArg_1)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.smallrye.mutiny.Uni<Void>
assign(io.vertx.kafka.client.common.TopicPartition topicPartition)
Manually assign a partition to this consumer.io.smallrye.mutiny.Uni<Void>
assign(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Manually assign a list of partition to this consumer.Void
assignAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofassign(TopicPartition)
.Void
assignAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofassign(Set)
.KafkaConsumer<K,V>
assignAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofassign(TopicPartition)
that ignores the result of the operation.KafkaConsumer<K,V>
assignAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofassign(Set)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Set<io.vertx.kafka.client.common.TopicPartition>>
assignment()
Get the set of partitions currently assigned to this consumer.Set<io.vertx.kafka.client.common.TopicPartition>
assignmentAndAwait()
Blocking variant ofassignment()
.KafkaConsumer<K,V>
assignmentAndForget()
Variant ofassignment()
that ignores the result of the operation.KafkaConsumer<K,V>
batchHandler(Consumer<KafkaConsumerRecords<K,V>> handler)
io.smallrye.mutiny.Uni<Long>
beginningOffsets(io.vertx.kafka.client.common.TopicPartition topicPartition)
Get the first offset for the given partitions.Long
beginningOffsetsAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofbeginningOffsets(TopicPartition)
.void
beginningOffsetsAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofbeginningOffsets(TopicPartition)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
close()
Close the consumerVoid
closeAndAwait()
Blocking variant ofclose()
.void
closeAndForget()
Variant ofclose()
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
commit()
Commit current offsets for all the subscribed list of topics and partition.Void
commitAndAwait()
Blocking variant ofcommit()
.void
commitAndForget()
Variant ofcommit()
that ignores the result of the operation.io.smallrye.mutiny.Uni<io.vertx.kafka.client.consumer.OffsetAndMetadata>
committed(io.vertx.kafka.client.common.TopicPartition topicPartition)
Get the last committed offset for the given partition (whether the commit happened by this process or another).io.vertx.kafka.client.consumer.OffsetAndMetadata
committedAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofcommitted(TopicPartition)
.void
committedAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofcommitted(TopicPartition)
that ignores the result of the operation.static <K,V>
KafkaConsumer<K,V>create(Vertx vertx, io.vertx.kafka.client.common.KafkaClientOptions options)
static <K,V>
KafkaConsumer<K,V>create(Vertx vertx, io.vertx.kafka.client.common.KafkaClientOptions options, Class<K> keyType, Class<V> valueType)
static <K,V>
KafkaConsumer<K,V>create(Vertx vertx, Map<String,String> config)
static <K,V>
KafkaConsumer<K,V>create(Vertx vertx, Map<String,String> config, Class<K> keyType, Class<V> valueType)
static <K,V>
KafkaConsumer<K,V>create(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
static <K,V>
KafkaConsumer<K,V>create(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer, io.vertx.kafka.client.common.KafkaClientOptions options)
long
demand()
KafkaConsumer<K,V>
endHandler(Runnable endHandler)
io.smallrye.mutiny.Uni<Long>
endOffsets(io.vertx.kafka.client.common.TopicPartition topicPartition)
Get the last offset for the given partition.Long
endOffsetsAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofendOffsets(TopicPartition)
.void
endOffsetsAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofendOffsets(TopicPartition)
that ignores the result of the operation.boolean
equals(Object o)
KafkaConsumer<K,V>
exceptionHandler(Consumer<Throwable> handler)
KafkaConsumer<K,V>
fetch(long amount)
io.vertx.kafka.client.consumer.KafkaConsumer
getDelegate()
KafkaConsumer<K,V>
handler(Consumer<KafkaConsumerRecord<K,V>> handler)
int
hashCode()
static <K,V>
KafkaConsumer<K,V>newInstance(io.vertx.kafka.client.consumer.KafkaConsumer arg)
static <K,V>
KafkaConsumer<K,V>newInstance(io.vertx.kafka.client.consumer.KafkaConsumer arg, TypeArg<K> __typeArg_K, TypeArg<V> __typeArg_V)
io.smallrye.mutiny.Uni<io.vertx.kafka.client.consumer.OffsetAndTimestamp>
offsetsForTimes(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)
Look up the offset for the given partition by timestamp.io.vertx.kafka.client.consumer.OffsetAndTimestamp
offsetsForTimesAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)
Blocking variant ofoffsetsForTimes(TopicPartition,Long)
.void
offsetsForTimesAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)
Variant ofoffsetsForTimes(TopicPartition,Long)
that ignores the result of the operation.KafkaConsumer<K,V>
partitionsAssignedHandler(Consumer<Set<io.vertx.kafka.client.common.TopicPartition>> handler)
io.smallrye.mutiny.Uni<List<io.vertx.kafka.client.common.PartitionInfo>>
partitionsFor(String topic)
Get metadata about the partitions for a given topic.List<io.vertx.kafka.client.common.PartitionInfo>
partitionsForAndAwait(String topic)
Blocking variant ofpartitionsFor(String)
.KafkaConsumer<K,V>
partitionsForAndForget(String topic)
Variant ofpartitionsFor(String)
that ignores the result of the operation.KafkaConsumer<K,V>
partitionsRevokedHandler(Consumer<Set<io.vertx.kafka.client.common.TopicPartition>> handler)
KafkaConsumer<K,V>
pause()
io.smallrye.mutiny.Uni<Void>
pause(io.vertx.kafka.client.common.TopicPartition topicPartition)
Suspend fetching from the requested partition.io.smallrye.mutiny.Uni<Void>
pause(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Suspend fetching from the requested partitions.Void
pauseAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofpause(TopicPartition)
.Void
pauseAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofpause(Set)
.KafkaConsumer<K,V>
pauseAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofpause(TopicPartition)
that ignores the result of the operation.KafkaConsumer<K,V>
pauseAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofpause(Set)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Set<io.vertx.kafka.client.common.TopicPartition>>
paused()
Get the set of partitions that were previously paused by a call to pause(Set).Set<io.vertx.kafka.client.common.TopicPartition>
pausedAndAwait()
Blocking variant ofpaused()
.void
pausedAndForget()
Variant ofpaused()
that ignores the result of the operation.Pipe<KafkaConsumerRecord<K,V>>
pipe()
io.smallrye.mutiny.Uni<Void>
pipeTo(WriteStream<KafkaConsumerRecord<K,V>> dst)
Pipe thisReadStream
to theWriteStream
.Void
pipeToAndAwait(WriteStream<KafkaConsumerRecord<K,V>> dst)
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.void
pipeToAndForget(WriteStream<KafkaConsumerRecord<K,V>> dst)
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.io.smallrye.mutiny.Uni<KafkaConsumerRecords<K,V>>
poll(Duration timeout)
Executes a poll for getting messages from Kafka.KafkaConsumerRecords<K,V>
pollAndAwait(Duration timeout)
Blocking variant ofpoll(Duration)
.void
pollAndForget(Duration timeout)
Variant ofpoll(Duration)
that ignores the result of the operation.KafkaConsumer<K,V>
pollTimeout(Duration timeout)
io.smallrye.mutiny.Uni<Long>
position(io.vertx.kafka.client.common.TopicPartition partition)
Get the offset of the next record that will be fetched (if a record with that offset exists).Long
positionAndAwait(io.vertx.kafka.client.common.TopicPartition partition)
Blocking variant ofposition(TopicPartition)
.void
positionAndForget(io.vertx.kafka.client.common.TopicPartition partition)
Variant ofposition(TopicPartition)
that ignores the result of the operation.KafkaConsumer<K,V>
resume()
io.smallrye.mutiny.Uni<Void>
resume(io.vertx.kafka.client.common.TopicPartition topicPartition)
Resume specified partition which have been paused with pause.io.smallrye.mutiny.Uni<Void>
resume(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Resume specified partitions which have been paused with pause.Void
resumeAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofresume(TopicPartition)
.Void
resumeAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofresume(Set)
.KafkaConsumer<K,V>
resumeAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofresume(TopicPartition)
that ignores the result of the operation.KafkaConsumer<K,V>
resumeAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofresume(Set)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
seek(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset)
Overrides the fetch offsets that the consumer will use on the next poll.Void
seekAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset)
Blocking variant ofseek(TopicPartition,long)
.KafkaConsumer<K,V>
seekAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset)
Variant ofseek(TopicPartition,long)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
seekToBeginning(io.vertx.kafka.client.common.TopicPartition topicPartition)
Seek to the first offset for each of the given partition.io.smallrye.mutiny.Uni<Void>
seekToBeginning(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Seek to the first offset for each of the given partitions.Void
seekToBeginningAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofseekToBeginning(TopicPartition)
.Void
seekToBeginningAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofseekToBeginning(Set)
.KafkaConsumer<K,V>
seekToBeginningAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofseekToBeginning(TopicPartition)
that ignores the result of the operation.KafkaConsumer<K,V>
seekToBeginningAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofseekToBeginning(Set)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
seekToEnd(io.vertx.kafka.client.common.TopicPartition topicPartition)
Seek to the last offset for each of the given partition.io.smallrye.mutiny.Uni<Void>
seekToEnd(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Seek to the last offset for each of the given partitions.Void
seekToEndAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofseekToEnd(TopicPartition)
.Void
seekToEndAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofseekToEnd(Set)
.KafkaConsumer<K,V>
seekToEndAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofseekToEnd(TopicPartition)
that ignores the result of the operation.KafkaConsumer<K,V>
seekToEndAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofseekToEnd(Set)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
subscribe(String topic)
Subscribe to the given topic to get dynamically assigned partitions.io.smallrye.mutiny.Uni<Void>
subscribe(Set<String> topics)
Subscribe to the given list of topics to get dynamically assigned partitions.Void
subscribeAndAwait(String topic)
Blocking variant ofsubscribe(String)
.Void
subscribeAndAwait(Set<String> topics)
Blocking variant ofsubscribe(Set)
.KafkaConsumer<K,V>
subscribeAndForget(String topic)
Variant ofsubscribe(String)
that ignores the result of the operation.KafkaConsumer<K,V>
subscribeAndForget(Set<String> topics)
Variant ofsubscribe(Set)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Set<String>>
subscription()
Get the current subscription.Set<String>
subscriptionAndAwait()
Blocking variant ofsubscription()
.KafkaConsumer<K,V>
subscriptionAndForget()
Variant ofsubscription()
that ignores the result of the operation.Iterable<KafkaConsumerRecord<K,V>>
toBlockingIterable()
Stream<KafkaConsumerRecord<K,V>>
toBlockingStream()
io.smallrye.mutiny.Multi<KafkaConsumerRecord<K,V>>
toMulti()
String
toString()
io.smallrye.mutiny.Uni<Void>
unsubscribe()
Unsubscribe from topics currently subscribed with subscribe.Void
unsubscribeAndAwait()
Blocking variant ofunsubscribe()
.KafkaConsumer<K,V>
unsubscribeAndForget()
Variant ofunsubscribe()
that ignores the result of the operation.
-
-
-
Method Detail
-
getDelegate
public io.vertx.kafka.client.consumer.KafkaConsumer getDelegate()
- Specified by:
getDelegate
in interfaceReadStream<K>
- Specified by:
getDelegate
in interfaceStreamBase
-
pipe
public Pipe<KafkaConsumerRecord<K,V>> pipe()
- Specified by:
pipe
in interfaceReadStream<K>
- Returns:
- a pipe
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<KafkaConsumerRecord<K,V>> dst)
Description copied from interface:ReadStream
Pipe thisReadStream
to theWriteStream
.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handler
will be called with the result.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
pipeTo
in interfaceReadStream<K>
- Parameters:
dst
- the destination write stream- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
public Void pipeToAndAwait(WriteStream<KafkaConsumerRecord<K,V>> dst)
Description copied from interface:ReadStream
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
pipeToAndAwait
in interfaceReadStream<K>
- Parameters:
dst
- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
public void pipeToAndForget(WriteStream<KafkaConsumerRecord<K,V>> dst)
Description copied from interface:ReadStream
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.This method subscribes on the result of
ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
but you don't need to compose it with other operations.- Specified by:
pipeToAndForget
in interfaceReadStream<K>
- Parameters:
dst
- the destination write stream
-
create
public static <K,V> KafkaConsumer<K,V> create(Vertx vertx, Map<String,String> config)
- Parameters:
vertx
- Vert.x instance to useconfig
- Kafka consumer configuration- Returns:
- an instance of the KafkaConsumer
-
create
public static <K,V> KafkaConsumer<K,V> create(Vertx vertx, Map<String,String> config, Class<K> keyType, Class<V> valueType)
- Parameters:
vertx
- Vert.x instance to useconfig
- Kafka consumer configurationkeyType
- class type for the key deserializationvalueType
- class type for the value deserialization- Returns:
- an instance of the KafkaConsumer
-
create
public static <K,V> KafkaConsumer<K,V> create(Vertx vertx, io.vertx.kafka.client.common.KafkaClientOptions options)
- Parameters:
vertx
- Vert.x instance to useoptions
- Kafka consumer options- Returns:
- an instance of the KafkaConsumer
-
create
public static <K,V> KafkaConsumer<K,V> create(Vertx vertx, io.vertx.kafka.client.common.KafkaClientOptions options, Class<K> keyType, Class<V> valueType)
- Parameters:
vertx
- Vert.x instance to useoptions
- Kafka consumer optionskeyType
- class type for the key deserializationvalueType
- class type for the value deserialization- Returns:
- an instance of the KafkaConsumer
-
exceptionHandler
public KafkaConsumer<K,V> exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandler
in interfaceReadStream<K>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
-
handler
public KafkaConsumer<K,V> handler(Consumer<KafkaConsumerRecord<K,V>> handler)
- Specified by:
handler
in interfaceReadStream<K>
- Returns:
-
pause
public KafkaConsumer<K,V> pause()
- Specified by:
pause
in interfaceReadStream<K>
- Returns:
- a reference to this, so the API can be used fluently
-
resume
public KafkaConsumer<K,V> resume()
- Specified by:
resume
in interfaceReadStream<K>
- Returns:
- a reference to this, so the API can be used fluently
-
fetch
public KafkaConsumer<K,V> fetch(long amount)
- Specified by:
fetch
in interfaceReadStream<K>
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public KafkaConsumer<K,V> endHandler(Runnable endHandler)
- Specified by:
endHandler
in interfaceReadStream<K>
- Returns:
-
demand
public long demand()
- Returns:
- current demand
-
subscribe
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> subscribe(String topic)
Subscribe to the given topic to get dynamically assigned partitions.Due to internal buffering of messages, when changing the subscribed topic the old topic may remain in effect (as observed by the record handler}) until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new topic.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topic
- topic to subscribe to- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
subscribeAndAwait
public Void subscribeAndAwait(String topic)
Blocking variant ofsubscribe(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topic
- topic to subscribe to- Returns:
- the Void instance produced by the operation.
-
subscribeAndForget
public KafkaConsumer<K,V> subscribeAndForget(String topic)
Variant ofsubscribe(String)
that ignores the result of the operation.This method subscribes on the result of
subscribe(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsubscribe(String)
but you don't need to compose it with other operations.- Parameters:
topic
- topic to subscribe to- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
subscribe
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> subscribe(Set<String> topics)
Subscribe to the given list of topics to get dynamically assigned partitions.Due to internal buffering of messages, when changing the subscribed topics the old set of topics may remain in effect (as observed by the record handler}) until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new set of topics.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topics
- topics to subscribe to- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
subscribeAndAwait
public Void subscribeAndAwait(Set<String> topics)
Blocking variant ofsubscribe(Set)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topics
- topics to subscribe to- Returns:
- the Void instance produced by the operation.
-
subscribeAndForget
public KafkaConsumer<K,V> subscribeAndForget(Set<String> topics)
Variant ofsubscribe(Set)
that ignores the result of the operation.This method subscribes on the result of
subscribe(Set)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsubscribe(Set)
but you don't need to compose it with other operations.- Parameters:
topics
- topics to subscribe to- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
assign
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> assign(io.vertx.kafka.client.common.TopicPartition topicPartition)
Manually assign a partition to this consumer.Due to internal buffering of messages, when reassigning the old partition may remain in effect (as observed by the record handler)} until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new partition.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- partition which want assigned- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
assignAndAwait
public Void assignAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofassign(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- partition which want assigned- Returns:
- the Void instance produced by the operation.
-
assignAndForget
public KafkaConsumer<K,V> assignAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofassign(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
assign(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromassign(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- partition which want assigned- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
assign
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> assign(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Manually assign a list of partition to this consumer.Due to internal buffering of messages, when reassigning the old set of partitions may remain in effect (as observed by the record handler)} until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new set of partitions.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartitions
- partitions which want assigned- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
assignAndAwait
public Void assignAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofassign(Set)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartitions
- partitions which want assigned- Returns:
- the Void instance produced by the operation.
-
assignAndForget
public KafkaConsumer<K,V> assignAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofassign(Set)
that ignores the result of the operation.This method subscribes on the result of
assign(Set)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromassign(Set)
but you don't need to compose it with other operations.- Parameters:
topicPartitions
- partitions which want assigned- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
assignment
@CheckReturnValue public io.smallrye.mutiny.Uni<Set<io.vertx.kafka.client.common.TopicPartition>> assignment()
Get the set of partitions currently assigned to this consumer.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
assignmentAndAwait
public Set<io.vertx.kafka.client.common.TopicPartition> assignmentAndAwait()
Blocking variant ofassignment()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Set
instance produced by the operation.
-
assignmentAndForget
public KafkaConsumer<K,V> assignmentAndForget()
Variant ofassignment()
that ignores the result of the operation.This method subscribes on the result of
assignment()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromassignment()
but you don't need to compose it with other operations.- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
unsubscribe
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> unsubscribe()
Unsubscribe from topics currently subscribed with subscribe.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
unsubscribeAndAwait
public Void unsubscribeAndAwait()
Blocking variant ofunsubscribe()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
unsubscribeAndForget
public KafkaConsumer<K,V> unsubscribeAndForget()
Variant ofunsubscribe()
that ignores the result of the operation.This method subscribes on the result of
unsubscribe()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromunsubscribe()
but you don't need to compose it with other operations.- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
subscription
@CheckReturnValue public io.smallrye.mutiny.Uni<Set<String>> subscription()
Get the current subscription.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
subscriptionAndAwait
public Set<String> subscriptionAndAwait()
Blocking variant ofsubscription()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Set
instance produced by the operation.
-
subscriptionAndForget
public KafkaConsumer<K,V> subscriptionAndForget()
Variant ofsubscription()
that ignores the result of the operation.This method subscribes on the result of
subscription()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsubscription()
but you don't need to compose it with other operations.- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
pause
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pause(io.vertx.kafka.client.common.TopicPartition topicPartition)
Suspend fetching from the requested partition.Due to internal buffering of messages, the will continue to observe messages from the given
topicPartition
until some time after the givencompletionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will not see messages from the giventopicPartition
.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- topic partition from which suspend fetching- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pauseAndAwait
public Void pauseAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofpause(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- topic partition from which suspend fetching- Returns:
- the Void instance produced by the operation.
-
pauseAndForget
public KafkaConsumer<K,V> pauseAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofpause(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
pause(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompause(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- topic partition from which suspend fetching- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
pause
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pause(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Suspend fetching from the requested partitions.Due to internal buffering of messages, the will continue to observe messages from the given
topicPartitions
until some time after the givencompletionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will not see messages from the giventopicPartitions
.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartitions
- topic partition from which suspend fetching- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pauseAndAwait
public Void pauseAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofpause(Set)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartitions
- topic partition from which suspend fetching- Returns:
- the Void instance produced by the operation.
-
pauseAndForget
public KafkaConsumer<K,V> pauseAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofpause(Set)
that ignores the result of the operation.This method subscribes on the result of
pause(Set)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompause(Set)
but you don't need to compose it with other operations.- Parameters:
topicPartitions
- topic partition from which suspend fetching- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
paused
@CheckReturnValue public io.smallrye.mutiny.Uni<Set<io.vertx.kafka.client.common.TopicPartition>> paused()
Get the set of partitions that were previously paused by a call to pause(Set).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pausedAndAwait
public Set<io.vertx.kafka.client.common.TopicPartition> pausedAndAwait()
Blocking variant ofpaused()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Set
instance produced by the operation.
-
pausedAndForget
public void pausedAndForget()
-
resume
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> resume(io.vertx.kafka.client.common.TopicPartition topicPartition)
Resume specified partition which have been paused with pause.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- topic partition from which resume fetching- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
resumeAndAwait
public Void resumeAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofresume(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- topic partition from which resume fetching- Returns:
- the Void instance produced by the operation.
-
resumeAndForget
public KafkaConsumer<K,V> resumeAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofresume(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
resume(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromresume(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- topic partition from which resume fetching- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
resume
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> resume(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Resume specified partitions which have been paused with pause.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartitions
- topic partition from which resume fetching- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
resumeAndAwait
public Void resumeAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofresume(Set)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartitions
- topic partition from which resume fetching- Returns:
- the Void instance produced by the operation.
-
resumeAndForget
public KafkaConsumer<K,V> resumeAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofresume(Set)
that ignores the result of the operation.This method subscribes on the result of
resume(Set)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromresume(Set)
but you don't need to compose it with other operations.- Parameters:
topicPartitions
- topic partition from which resume fetching- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
partitionsRevokedHandler
public KafkaConsumer<K,V> partitionsRevokedHandler(Consumer<Set<io.vertx.kafka.client.common.TopicPartition>> handler)
- Parameters:
handler
- handler called on revoked topic partitions- Returns:
-
partitionsAssignedHandler
public KafkaConsumer<K,V> partitionsAssignedHandler(Consumer<Set<io.vertx.kafka.client.common.TopicPartition>> handler)
- Parameters:
handler
- handler called on assigned topic partitions- Returns:
-
seek
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> seek(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset)
Overrides the fetch offsets that the consumer will use on the next poll.Due to internal buffering of messages, the will continue to observe messages fetched with respect to the old offset until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new offset.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- topic partition for which seekoffset
- offset to seek inside the topic partition- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
seekAndAwait
public Void seekAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset)
Blocking variant ofseek(TopicPartition,long)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- topic partition for which seekoffset
- offset to seek inside the topic partition- Returns:
- the Void instance produced by the operation.
-
seekAndForget
public KafkaConsumer<K,V> seekAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset)
Variant ofseek(TopicPartition,long)
that ignores the result of the operation.This method subscribes on the result of
seek(TopicPartition,long)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromseek(TopicPartition,long)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- topic partition for which seekoffset
- offset to seek inside the topic partition- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
seekToBeginning
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> seekToBeginning(io.vertx.kafka.client.common.TopicPartition topicPartition)
Seek to the first offset for each of the given partition.Due to internal buffering of messages, the will continue to observe messages fetched with respect to the old offset until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new offset.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- topic partition for which seek- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
seekToBeginningAndAwait
public Void seekToBeginningAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofseekToBeginning(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- topic partition for which seek- Returns:
- the Void instance produced by the operation.
-
seekToBeginningAndForget
public KafkaConsumer<K,V> seekToBeginningAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofseekToBeginning(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
seekToBeginning(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromseekToBeginning(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- topic partition for which seek- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
seekToBeginning
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> seekToBeginning(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Seek to the first offset for each of the given partitions.Due to internal buffering of messages, the will continue to observe messages fetched with respect to the old offset until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new offset.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartitions
- topic partition for which seek- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
seekToBeginningAndAwait
public Void seekToBeginningAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofseekToBeginning(Set)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartitions
- topic partition for which seek- Returns:
- the Void instance produced by the operation.
-
seekToBeginningAndForget
public KafkaConsumer<K,V> seekToBeginningAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofseekToBeginning(Set)
that ignores the result of the operation.This method subscribes on the result of
seekToBeginning(Set)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromseekToBeginning(Set)
but you don't need to compose it with other operations.- Parameters:
topicPartitions
- topic partition for which seek- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
seekToEnd
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> seekToEnd(io.vertx.kafka.client.common.TopicPartition topicPartition)
Seek to the last offset for each of the given partition.Due to internal buffering of messages, the will continue to observe messages fetched with respect to the old offset until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new offset.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- topic partition for which seek- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
seekToEndAndAwait
public Void seekToEndAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofseekToEnd(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- topic partition for which seek- Returns:
- the Void instance produced by the operation.
-
seekToEndAndForget
public KafkaConsumer<K,V> seekToEndAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofseekToEnd(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
seekToEnd(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromseekToEnd(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- topic partition for which seek- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
seekToEnd
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> seekToEnd(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Seek to the last offset for each of the given partitions.Due to internal buffering of messages, the will continue to observe messages fetched with respect to the old offset until some time after the given
completionHandler
is called. In contrast, the once the givencompletionHandler
is called thebatchHandler(java.util.function.Consumer<io.vertx.mutiny.kafka.client.consumer.KafkaConsumerRecords<K, V>>)
will only see messages consistent with the new offset.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartitions
- topic partition for which seek- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
seekToEndAndAwait
public Void seekToEndAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Blocking variant ofseekToEnd(Set)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartitions
- topic partition for which seek- Returns:
- the Void instance produced by the operation.
-
seekToEndAndForget
public KafkaConsumer<K,V> seekToEndAndForget(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
Variant ofseekToEnd(Set)
that ignores the result of the operation.This method subscribes on the result of
seekToEnd(Set)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromseekToEnd(Set)
but you don't need to compose it with other operations.- Parameters:
topicPartitions
- topic partition for which seek- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
commit
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> commit()
Commit current offsets for all the subscribed list of topics and partition.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
commitAndAwait
public Void commitAndAwait()
Blocking variant ofcommit()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
commitAndForget
public void commitAndForget()
-
committed
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.kafka.client.consumer.OffsetAndMetadata> committed(io.vertx.kafka.client.common.TopicPartition topicPartition)
Get the last committed offset for the given partition (whether the commit happened by this process or another).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- topic partition for getting last committed offset- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
committedAndAwait
public io.vertx.kafka.client.consumer.OffsetAndMetadata committedAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofcommitted(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- topic partition for getting last committed offset- Returns:
- the OffsetAndMetadata instance produced by the operation.
-
committedAndForget
public void committedAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofcommitted(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
committed(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromcommitted(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- topic partition for getting last committed offset
-
partitionsFor
@CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.kafka.client.common.PartitionInfo>> partitionsFor(String topic)
Get metadata about the partitions for a given topic.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topic
- topic partition for which getting partitions info- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
partitionsForAndAwait
public List<io.vertx.kafka.client.common.PartitionInfo> partitionsForAndAwait(String topic)
Blocking variant ofpartitionsFor(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topic
- topic partition for which getting partitions info- Returns:
- the List
instance produced by the operation.
-
partitionsForAndForget
public KafkaConsumer<K,V> partitionsForAndForget(String topic)
Variant ofpartitionsFor(String)
that ignores the result of the operation.This method subscribes on the result of
partitionsFor(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompartitionsFor(String)
but you don't need to compose it with other operations.- Parameters:
topic
- topic partition for which getting partitions info- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
batchHandler
public KafkaConsumer<K,V> batchHandler(Consumer<KafkaConsumerRecords<K,V>> handler)
- Parameters:
handler
- handler called when batches of messages are fetched- Returns:
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
Close the consumerUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofclose()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget()
-
position
@CheckReturnValue public io.smallrye.mutiny.Uni<Long> position(io.vertx.kafka.client.common.TopicPartition partition)
Get the offset of the next record that will be fetched (if a record with that offset exists).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
partition
- The partition to get the position for- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
positionAndAwait
public Long positionAndAwait(io.vertx.kafka.client.common.TopicPartition partition)
Blocking variant ofposition(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
partition
- The partition to get the position for- Returns:
- the Long instance produced by the operation.
-
positionAndForget
public void positionAndForget(io.vertx.kafka.client.common.TopicPartition partition)
Variant ofposition(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
position(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromposition(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
partition
- The partition to get the position for
-
offsetsForTimes
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.kafka.client.consumer.OffsetAndTimestamp> offsetsForTimes(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)
Look up the offset for the given partition by timestamp. Note: the result might be null in case for the given timestamp no offset can be found -- e.g., when the timestamp refers to the futureUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- TopicPartition to query.timestamp
- Timestamp to be used in the query.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
offsetsForTimesAndAwait
public io.vertx.kafka.client.consumer.OffsetAndTimestamp offsetsForTimesAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)
Blocking variant ofoffsetsForTimes(TopicPartition,Long)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- TopicPartition to query.timestamp
- Timestamp to be used in the query.- Returns:
- the OffsetAndTimestamp instance produced by the operation.
-
offsetsForTimesAndForget
public void offsetsForTimesAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)
Variant ofoffsetsForTimes(TopicPartition,Long)
that ignores the result of the operation.This method subscribes on the result of
offsetsForTimes(TopicPartition,Long)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromoffsetsForTimes(TopicPartition,Long)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- TopicPartition to query.timestamp
- Timestamp to be used in the query.
-
beginningOffsets
@CheckReturnValue public io.smallrye.mutiny.Uni<Long> beginningOffsets(io.vertx.kafka.client.common.TopicPartition topicPartition)
Get the first offset for the given partitions.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- the partition to get the earliest offset.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
beginningOffsetsAndAwait
public Long beginningOffsetsAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofbeginningOffsets(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- the partition to get the earliest offset.- Returns:
- the Long instance produced by the operation.
-
beginningOffsetsAndForget
public void beginningOffsetsAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofbeginningOffsets(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
beginningOffsets(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frombeginningOffsets(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- the partition to get the earliest offset.
-
endOffsets
@CheckReturnValue public io.smallrye.mutiny.Uni<Long> endOffsets(io.vertx.kafka.client.common.TopicPartition topicPartition)
Get the last offset for the given partition. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
topicPartition
- the partition to get the end offset.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
endOffsetsAndAwait
public Long endOffsetsAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)
Blocking variant ofendOffsets(TopicPartition)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
topicPartition
- the partition to get the end offset.- Returns:
- the Long instance produced by the operation.
-
endOffsetsAndForget
public void endOffsetsAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)
Variant ofendOffsets(TopicPartition)
that ignores the result of the operation.This method subscribes on the result of
endOffsets(TopicPartition)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromendOffsets(TopicPartition)
but you don't need to compose it with other operations.- Parameters:
topicPartition
- the partition to get the end offset.
-
create
public static <K,V> KafkaConsumer<K,V> create(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)
- Parameters:
vertx
- Vert.x instance to useconsumer
- the Kafka consumer to wrap- Returns:
- an instance of the KafkaConsumer
-
create
public static <K,V> KafkaConsumer<K,V> create(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer, io.vertx.kafka.client.common.KafkaClientOptions options)
- Parameters:
vertx
- Vert.x instance to useconsumer
- the Kafka consumer to wrapoptions
- options used only for tracing settings- Returns:
- an instance of the KafkaConsumer
-
pollTimeout
public KafkaConsumer<K,V> pollTimeout(Duration timeout)
- Parameters:
timeout
- The time, spent waiting in poll if data is not available in the buffer. If 0, returns immediately with any records that are available currently in the native Kafka consumer's buffer, else returns empty. Must not be negative.- Returns:
- the instance of KafkaConsumer
to chain method calls.
-
poll
@CheckReturnValue public io.smallrye.mutiny.Uni<KafkaConsumerRecords<K,V>> poll(Duration timeout)
Executes a poll for getting messages from Kafka.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
timeout
- The maximum time to block (must not be greater thanLong
milliseconds)- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pollAndAwait
public KafkaConsumerRecords<K,V> pollAndAwait(Duration timeout)
Blocking variant ofpoll(Duration)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
timeout
- The maximum time to block (must not be greater thanLong
milliseconds)- Returns:
- the KafkaConsumerRecords
instance produced by the operation.
-
pollAndForget
public void pollAndForget(Duration timeout)
Variant ofpoll(Duration)
that ignores the result of the operation.This method subscribes on the result of
poll(Duration)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompoll(Duration)
but you don't need to compose it with other operations.- Parameters:
timeout
- The maximum time to block (must not be greater thanLong
milliseconds)
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<KafkaConsumerRecord<K,V>> toMulti()
- Specified by:
toMulti
in interfaceReadStream<K>
-
toBlockingIterable
public Iterable<KafkaConsumerRecord<K,V>> toBlockingIterable()
-
toBlockingStream
public Stream<KafkaConsumerRecord<K,V>> toBlockingStream()
-
newInstance
public static <K,V> KafkaConsumer<K,V> newInstance(io.vertx.kafka.client.consumer.KafkaConsumer arg)
-
newInstance
public static <K,V> KafkaConsumer<K,V> newInstance(io.vertx.kafka.client.consumer.KafkaConsumer arg, TypeArg<K> __typeArg_K, TypeArg<V> __typeArg_V)
-
-