[
https://issues.apache.org/jira/browse/KAFKA-1780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ewen Cheslack-Postava updated KAFKA-1780:
-----------------------------------------
Resolution: Won't Fix
Status: Resolved (was: Patch Available)
This will be better addressed by the new consumer and has a workable solution
with small, but reasonable, timeouts with the old consumer.
> Add peek()/poll() for ConsumerIterator
> --------------------------------------
>
> Key: KAFKA-1780
> URL: https://issues.apache.org/jira/browse/KAFKA-1780
> Project: Kafka
> Issue Type: Bug
> Components: consumer
> Affects Versions: 0.8.1.1
> Reporter: Ewen Cheslack-Postava
> Assignee: Ewen Cheslack-Postava
> Attachments: KAFKA-1780.patch, KAFKA-1780_2014-11-24_17:24:54.patch
>
>
> Currently, all consumer operations (next(), haveNext()) block. This is
> problematic for a couple of use cases. Most obviously, a peek() method would
> be nice so you can at least check whether any data is immediately available,
> getting a null value back if it's not.
> A more difficult example is a proxy with a timeout, i.e. it consumes messages
> for up to N ms or M messages, and returns whatever it has at the end of that
> period. It's possible to approximate that with peek, but requires aggressive
> polling to match the proxy's timeout. A poll(timeout) method would allow for
> a correct implementation, where each call to poll gets a single message, but
> also allows the user to specify a custom timeout.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)