[ https://issues.apache.org/jira/browse/KAFKA-3007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15062996#comment-15062996 ]
aarti gupta edited comment on KAFKA-3007 at 12/17/15 10:44 PM: --------------------------------------------------------------- The concern is, that in the scenario in which I have more messages than I can keep in memory, I am currently forced to fetch all of them in a single poll. If pollOnce(), is not fetching a single message, then yes, it is not an api that is going to help limit the maximum number of messages fetched in a poll. Do we have a JIRA issue for the latter (adding a parameter to consumer.poll that limits the maximum number of messages returned by a poll), If not this can become the JIRA for the request? Happy to work on the Kafka improvement Proposal Wiki and the fix for this. was (Author: aartigupta): The concern is, that in the scenario in which I have more messages than I can keep in memory, I am currently forced to fetch all of them in a single poll. If pollOnce(), is not fetching a single message, then yes, it is not an api that is going to help limit the maximum number of messages fetched in a poll. Do we have a JIRA issue for the later (adding a parameter to consumer.poll that limits the maximum number of messages returned by a poll), If not this can become the JIRA for the request? Happy to work on the Kafka improvement Proposal Wiki and the fix for this. > new Consumer should expose mechanism to fetch single message, > consumer.poll(timeout, maxMessageLimit) > ----------------------------------------------------------------------------------------------------- > > Key: KAFKA-3007 > URL: https://issues.apache.org/jira/browse/KAFKA-3007 > Project: Kafka > Issue Type: Improvement > Components: consumer > Affects Versions: 0.9.0.0 > Reporter: aarti gupta > Assignee: Neha Narkhede > > Currently, the consumer.poll(timeout) > returns all messages that have not been acked since the last fetch > The only way to process a single message, is to throw away all but the first > message in the list > This would mean we are required to fetch all messages into memory, and this > coupled with the client being not thread-safe, (i.e. we cannot use a > different thread to ack messages, makes it hard to consume messages when the > order of message arrival is important, and a large number of messages are > pending to be consumed) -- This message was sent by Atlassian JIRA (v6.3.4#6332)