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.originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<KafkaConsumer>__TYPE_ARGTypeArg<K>__typeArg_0TypeArg<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.VoidassignAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofassign(TopicPartition).VoidassignAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#assign(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#assign(Setthat 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.LongbeginningOffsetsAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofbeginningOffsets(TopicPartition).voidbeginningOffsetsAndForget(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 consumerVoidcloseAndAwait()Blocking variant ofclose().voidcloseAndForget()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.VoidcommitAndAwait()Blocking variant ofcommit().voidcommitAndForget()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.OffsetAndMetadatacommittedAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofcommitted(TopicPartition).voidcommittedAndForget(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)longdemand()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.LongendOffsetsAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofendOffsets(TopicPartition).voidendOffsetsAndForget(io.vertx.kafka.client.common.TopicPartition topicPartition)Variant ofendOffsets(TopicPartition)that ignores the result of the operation.booleanequals(Object o)KafkaConsumer<K,V>exceptionHandler(Consumer<Throwable> handler)KafkaConsumer<K,V>fetch(long amount)io.vertx.kafka.client.consumer.KafkaConsumergetDelegate()KafkaConsumer<K,V>handler(Consumer<KafkaConsumerRecord<K,V>> handler)inthashCode()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.OffsetAndTimestampoffsetsForTimesAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition, Long timestamp)Blocking variant ofoffsetsForTimes(TopicPartition,Long).voidoffsetsForTimesAndForget(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.VoidpauseAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofpause(TopicPartition).VoidpauseAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#pause(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#pause(Setthat 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().voidpausedAndForget()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 thisReadStreamto theWriteStream.VoidpipeToAndAwait(WriteStream<KafkaConsumerRecord<K,V>> dst)Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream.) voidpipeToAndForget(WriteStream<KafkaConsumerRecord<K,V>> dst)Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreamthat 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).voidpollAndForget(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).LongpositionAndAwait(io.vertx.kafka.client.common.TopicPartition partition)Blocking variant ofposition(TopicPartition).voidpositionAndForget(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.VoidresumeAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofresume(TopicPartition).VoidresumeAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#resume(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#resume(Setthat 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.VoidseekAndAwait(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.VoidseekToBeginningAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofseekToBeginning(TopicPartition).VoidseekToBeginningAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToBeginning(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToBeginning(Setthat 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.VoidseekToEndAndAwait(io.vertx.kafka.client.common.TopicPartition topicPartition)Blocking variant ofseekToEnd(TopicPartition).VoidseekToEndAndAwait(Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToEnd(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToEnd(Setthat 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.VoidsubscribeAndAwait(String topic)Blocking variant ofsubscribe(String).VoidsubscribeAndAwait(Set<String> topics)Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#subscribe(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#subscribe(Setthat 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()StringtoString()io.smallrye.mutiny.Uni<Void>unsubscribe()Unsubscribe from topics currently subscribed with subscribe.VoidunsubscribeAndAwait()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:
getDelegatein interfaceReadStream<K>- Specified by:
getDelegatein interfaceStreamBase
-
pipe
public Pipe<KafkaConsumerRecord<K,V>> pipe()
- Specified by:
pipein interfaceReadStream<K>- Returns:
- a pipe
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<KafkaConsumerRecord<K,V>> dst)
Description copied from interface:ReadStreamPipe thisReadStreamto 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
handlerwill 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:
pipeToin interfaceReadStream<K>- Parameters:
dst- the destination write stream- Returns:
- the
unifiring 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:ReadStreamBlocking variant ofio.vertx.mutiny.core.streams.ReadStream#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:
pipeToAndAwaitin 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:ReadStreamVariant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreamthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreambut you don't need to compose it with other operations.) - Specified by:
pipeToAndForgetin 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:
exceptionHandlerin interfaceReadStream<K>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
-
handler
public KafkaConsumer<K,V> handler(Consumer<KafkaConsumerRecord<K,V>> handler)
- Specified by:
handlerin interfaceReadStream<K>- Returns:
-
pause
public KafkaConsumer<K,V> pause()
- Specified by:
pausein interfaceReadStream<K>- Returns:
- a reference to this, so the API can be used fluently
-
resume
public KafkaConsumer<K,V> resume()
- Specified by:
resumein interfaceReadStream<K>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
public KafkaConsumer<K,V> fetch(long amount)
- Specified by:
fetchin interfaceReadStream<K>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public KafkaConsumer<K,V> endHandler(Runnable endHandler)
- Specified by:
endHandlerin 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring the result of the operation when completed, or a failure if the operation failed.
-
subscribeAndAwait
public Void subscribeAndAwait(Set<String> topics)
Blocking variant ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#subscribe(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#subscribe(Setthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#subscribe(Set, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#subscribe(Setbut 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#assign(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#assign(Setthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#assign(Set, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#assign(Setbut 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
unifiring 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
unifiring 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
unifiring 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
topicPartitionuntil some time after the givencompletionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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
topicPartitionsuntil some time after the givencompletionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#pause(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#pause(Setthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#pause(Set, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#pause(Setbut 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
unifiring 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
unifiring 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
unifiring 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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#resume(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#resume(Setthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#resume(Set, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#resume(Setbut 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToBeginning(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToBeginning(Setthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToBeginning(Set, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToBeginning(Setbut 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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
completionHandleris called. In contrast, the once the givencompletionHandleris 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
unifiring 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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToEnd(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 ofio.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToEnd(Setthat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToEnd(Set, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.kafka.client.consumer.KafkaConsumer#seekToEnd(Setbut 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
unifiring 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
unifiring 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
unifiring 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
unifiring 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
unifiring 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
unifiring 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
unifiring 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
unifiring 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.
-
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 thanLongmilliseconds)- Returns:
- the
unifiring 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 thanLongmilliseconds)- 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 thanLongmilliseconds)
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<KafkaConsumerRecord<K,V>> toMulti()
- Specified by:
toMultiin 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)
-
-