You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Guozhang Wang (JIRA)" <ji...@apache.org> on 2015/12/28 19:58:49 UTC

[jira] [Commented] (KAFKA-3044) Consumer.poll doesnot return messages when poll interval is less

    [ https://issues.apache.org/jira/browse/KAFKA-3044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15073016#comment-15073016 ] 

Guozhang Wang commented on KAFKA-3044:
--------------------------------------

Hi [~praveend] I think the Java docs need to be reworded since "returns immediately with any records that are available now" could be a bit misleading, actually what it meant is that if there is already some data fetched from the server and buffered at the consumer client, return them immediately, otherwise return empty.

Assigning to [~hachikuji] to review and change the java docs. 

> Consumer.poll doesnot return messages when poll interval is less
> ----------------------------------------------------------------
>
>                 Key: KAFKA-3044
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3044
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 0.9.0.0
>            Reporter: Praveen Devarao
>            Assignee: Jason Gustafson
>             Fix For: 0.9.0.1
>
>
> When seeking to particular position in consumer and starting poll with timeout param 0 the consumer does not come back with data though there is data published via a producer already. If the timeout is increased slowly in chunks of 100ms then at 700ms value the consumer returns back the record on first call to poll.
> Docs [http://kafka.apache.org/090/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#poll(long)] for poll reads if timeout is 0 then data will be returned immediately but the behaviour seen is that data is not returned.
> The test code I am using can be found here https://gist.github.com/praveend/013dcab01ebb8c7e2f2d
> I have created a topic with data published as below and then running the test program [ConsumerPollTest.java]
> $ bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic mytopic
> $ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic mytopic
> Hello
> Hai
> bye
> $ java ConsumerPollTest
> I have published this 3 lines of data to kafka only once....later on I just use the above program with different poll interval
> Let me know if I am missing anything and interpreting it wrongly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)