kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dinesh kumar <dinesh...@gmail.com>
Subject Consumer reading from same topic twice without commiting
Date Fri, 14 Nov 2014 18:17:22 GMT
I am trying to understand the behavior of Kafka Consumer in Java.

Consider a scenario where a consumer is reading from a partition with
auto.comiit disabled and only one partition in the topic. The consumer
reads a message 'A' and sleep for some time, say 10 seconds. Then reads
from the same parition once again from the without commiting the offsets of
 the previous read a message 'B'.

My assumption was since there was no commit of the previous offset we will
get the same message message 'A' and message 'B' should be the same.

I ran a simple code with this assumption but I was suprised to see message
'A' and message 'B' were different (Producer produced Message 'B' after
message 'A').

Can someone explain this behavior? Is there a way to make the consumer
return message 'A' instead of message 'B' without restarting the consumer
(which will trigger a repartition in a multi partition/ multi consumer
scenario), say some parameter or a method call to rewind locally?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message