Package io.streamnative.kafka.client.api
Interface Consumer<K,V>
- All Superinterfaces:
AutoCloseable,Closeable
A common interface of Kafka consumer.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcommitOffsetSync(List<TopicOffsetAndMetadata> offsets, Duration timeout) listTopics(long timeoutMS) @NonNull List<ConsumerRecord<K,V>> receive(long timeoutMs) default List<ConsumerRecord<K,V>> receiveUntil(int maxNumMessages, long timeoutMs) Receive messages as much as possible until the number of received messages time exceeds limit or timed out.default voidvoidsubscribe(Collection<String> topics)
-
Method Details
-
subscribe
-
subscribe
-
receive
-
receiveUntil
Receive messages as much as possible until the number of received messages time exceeds limit or timed out.- Parameters:
maxNumMessages- the limited number of received messagestimeoutMs- the total timeout in milliseconds for this method- Returns:
- the total received messages
-
listTopics
-
commitOffsetSync
-