Class KafkaConsumer<K,V>
- All Implemented Interfaces:
MutinyDelegate
,ReadStream<KafkaConsumerRecord<K,
,V>> StreamBase
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()
and resume()
provides global control over reading the records from the consumer.
The pause()
and resume()
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 -
Constructor Summary
ConstructorsConstructorDescriptionKafkaConsumer
(io.vertx.kafka.client.consumer.KafkaConsumer delegate) KafkaConsumer
(io.vertx.kafka.client.consumer.KafkaConsumer delegate, TypeArg<K> typeArg_0, TypeArg<V> typeArg_1) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>
assign
(io.vertx.kafka.client.common.TopicPartition topicPartition) Manually assign a partition to this consumer.io.smallrye.mutiny.Uni<Void>
Manually assign a list of partition to this consumer.assignAndAwait
(io.vertx.kafka.client.common.TopicPartition topicPartition) Blocking variant ofassign(TopicPartition)
.assignAndAwait
(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions) Blocking variant ofassign(Set)
.assignAndForget
(io.vertx.kafka.client.common.TopicPartition topicPartition) Variant ofassign(TopicPartition)
that ignores the result of the operation.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>>
Get the set of partitions currently assigned to this consumer.Set<io.vertx.kafka.client.common.TopicPartition>
Blocking variant ofassignment()
.Variant ofassignment()
that ignores the result of the operation.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.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 consumerBlocking variant ofclose()
.void
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.Blocking variant ofcommit()
.void
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> 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> static <K,
V> KafkaConsumer<K, V> static <K,
V> KafkaConsumer<K, V> 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()
endHandler
(Runnable endHandler) io.smallrye.mutiny.Uni<Long>
endOffsets
(io.vertx.kafka.client.common.TopicPartition topicPartition) Get the last offset for the given partition.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
exceptionHandler
(Consumer<Throwable> handler) fetch
(long amount) io.vertx.kafka.client.consumer.KafkaConsumer
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.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)
.partitionsForAndForget
(String topic) Variant ofpartitionsFor(String)
that ignores the result of the operation.partitionsRevokedHandler
(Consumer<Set<io.vertx.kafka.client.common.TopicPartition>> handler) 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>
Suspend fetching from the requested partitions.pauseAndAwait
(io.vertx.kafka.client.common.TopicPartition topicPartition) Blocking variant ofpause(TopicPartition)
.pauseAndAwait
(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions) Blocking variant ofpause(Set)
.pauseAndForget
(io.vertx.kafka.client.common.TopicPartition topicPartition) Variant ofpause(TopicPartition)
that ignores the result of the operation.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>
Blocking variant ofpaused()
.void
Variant ofpaused()
that ignores the result of the operation.pipe()
io.smallrye.mutiny.Uni<Void>
pipeTo
(WriteStream<KafkaConsumerRecord<K, V>> dst) Pipe thisReadStream
to theWriteStream
.Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.void
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.io.smallrye.mutiny.Uni<KafkaConsumerRecords<K,
V>> Executes a poll for getting messages from Kafka.pollAndAwait
(Duration timeout) Blocking variant ofpoll(Duration)
.void
pollAndForget
(Duration timeout) Variant ofpoll(Duration)
that ignores the result of the operation.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).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.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 specified partitions which have been paused with pause.resumeAndAwait
(io.vertx.kafka.client.common.TopicPartition topicPartition) Blocking variant ofresume(TopicPartition)
.resumeAndAwait
(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions) Blocking variant ofresume(Set)
.resumeAndForget
(io.vertx.kafka.client.common.TopicPartition topicPartition) Variant ofresume(TopicPartition)
that ignores the result of the operation.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.seekAndAwait
(io.vertx.kafka.client.common.TopicPartition topicPartition, long offset) Blocking variant ofseek(TopicPartition,long)
.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.seekToBeginningAndAwait
(io.vertx.kafka.client.common.TopicPartition topicPartition) Blocking variant ofseekToBeginning(TopicPartition)
.seekToBeginningAndAwait
(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions) Blocking variant ofseekToBeginning(Set)
.seekToBeginningAndForget
(io.vertx.kafka.client.common.TopicPartition topicPartition) Variant ofseekToBeginning(TopicPartition)
that ignores the result of the operation.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>
Seek to the last offset for each of the given partitions.seekToEndAndAwait
(io.vertx.kafka.client.common.TopicPartition topicPartition) Blocking variant ofseekToEnd(TopicPartition)
.seekToEndAndAwait
(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions) Blocking variant ofseekToEnd(Set)
.seekToEndAndForget
(io.vertx.kafka.client.common.TopicPartition topicPartition) Variant ofseekToEnd(TopicPartition)
that ignores the result of the operation.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 to the given topic to get dynamically assigned partitions.io.smallrye.mutiny.Uni<Void>
Subscribe to the given list of topics to get dynamically assigned partitions.subscribeAndAwait
(String topic) Blocking variant ofsubscribe(String)
.subscribeAndAwait
(Set<String> topics) Blocking variant ofsubscribe(Set)
.subscribeAndForget
(String topic) Variant ofsubscribe(String)
that ignores the result of the operation.subscribeAndForget
(Set<String> topics) Variant ofsubscribe(Set)
that ignores the result of the operation.Get the current subscription.Blocking variant ofsubscription()
.Variant ofsubscription()
that ignores the result of the operation.io.smallrye.mutiny.Multi<KafkaConsumerRecord<K,
V>> toMulti()
toString()
io.smallrye.mutiny.Uni<Void>
Unsubscribe from topics currently subscribed with subscribe.Blocking variant ofunsubscribe()
.Variant ofunsubscribe()
that ignores the result of the operation.
-
Field Details
-
__TYPE_ARG
-
__typeArg_0
-
__typeArg_1
-
-
Constructor Details
-
KafkaConsumer
public KafkaConsumer(io.vertx.kafka.client.consumer.KafkaConsumer delegate) -
KafkaConsumer
-
KafkaConsumer
-
-
Method Details
-
getDelegate
public io.vertx.kafka.client.consumer.KafkaConsumer getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Specified by:
getDelegate
in interfaceReadStream<K>
- Specified by:
getDelegate
in interfaceStreamBase
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
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
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
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
- 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
- Specified by:
exceptionHandler
in interfaceReadStream<K>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
-
handler
- Specified by:
handler
in interfaceReadStream<K>
- Returns:
-
pause
- Specified by:
pause
in interfaceReadStream<K>
- Returns:
- a reference to this, so the API can be used fluently
-
resume
- Specified by:
resume
in interfaceReadStream<K>
- Returns:
- a reference to this, so the API can be used fluently
-
fetch
- Specified by:
fetch
in interfaceReadStream<K>
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
- Specified by:
endHandler
in interfaceReadStream<K>
- Returns:
-
demand
public long demand()- Returns:
- current demand
-
subscribe
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
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
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<K,V> to chain method calls.
-
subscribe
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
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
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<K,V> 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
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<K,V> 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
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<K,V> 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
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
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<K,V> to chain method calls.
-
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
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
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<K,V> to chain method calls.
-
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
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
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<K,V> 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
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<K,V> 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
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<K,V> 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
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
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<K,V> 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
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<K,V> 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
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<K,V> 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
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<K,V> 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<K,V> 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
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<K,V> 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
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<K,V> to chain method calls.
-
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
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
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
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<K,V> to chain method calls.
-
batchHandler
- Parameters:
handler
- handler called when batches of messages are fetched- Returns:
-
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
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
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
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
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
- 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<K,V> to chain method calls.
-
poll
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
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<K,V> instance produced by the operation.
-
pollAndForget
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
- Specified by:
toMulti
in interfaceReadStream<K>
-
toBlockingIterable
-
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)
-