i tired following the link
https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example
to use SimpleConsumer to consume messages but while using it I found some abrupt behavior as follows:
The consumers are consuming messages from a specific partition. But the issue is that When my consumer is running and I push messages to the topic using a producer it consumes messages from that partition. But if my consumer is not running at present and I push some messages to the topic and again start the consumer it do not consume the messages which were pushed by the producer but again it is ready to consume messages which will be pushed now. I am using LatestTime() instead od EarliestTime() as I want to consume only unprocessed messages.
For example
Case -1
Consumer is running :
Producer pushed M1, M2, M3 message to partition 1 of topic 1
result: consumer will consume all three messages.
Case - 2
Consumer is not running
producer now pushes m4, m5 m6 messgae to partition 1 of topic 1
consumer is invoked now
result : consumer donot consume messgaes m4, m5, m6 but If I will check the offset then it is set to 7. This means the producer has advanced the offset to 7 while producing messages as a result the consumer will consume messages from offset 7 now
Please help ideally when when consumer comes up again it should read messages from m4.