KafkaConsumer API: internal cache and visibility of it #3897
-
Is there any good way to tell if KafkaConsumer has anything stored in internal queue "cache" for messages? e.g. by trying to consume(...) again with timeout = 0 ? I'm trying to figure out if it's possible to invoke FWIW, this appears to be working, but it would be great to get a confirmation whether it is depending on undefined behaviour:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Messages are prefetched from the Kafka broker and put in an internal queue, all that consume() does is pop a message from that internal queue - so there is very little overhead in calling consume() and your approach seems fine to me. https://github.com/edenhill/librdkafka/wiki/FAQ#how-are-partitions-fetched |
Beta Was this translation helpful? Give feedback.
Messages are prefetched from the Kafka broker and put in an internal queue, all that consume() does is pop a message from that internal queue - so there is very little overhead in calling consume() and your approach seems fine to me.
https://github.com/edenhill/librdkafka/wiki/FAQ#how-are-partitions-fetched