title: Reading messages offset in Apache Kafka
body: <p>I am very much new to <code>Kafka</code> and we are using <code>Kafka 0.8.1</code>. </p>
  
  <p>What I need to do is to consume a message from topic. For that, I will have to write one consumer in Java which will consume a message from topic and then save that message to database. After a message is saved, some acknowledgement will be sent to Java consumer. If acknowledgement is true, then next message should be consumed from the topic. If acknowldgement is false(which means due to some error message,read from the topic, couldn't be saved into the database), then again that message should be read. </p>
  
  <p>I think I need to use  <code>Simple Consumer</code>,to have control over message offset and have gone through the Simple Consumer example as given in this link <a href="https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example" rel="nofollow">https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example</a>. </p>
  
  <p>In this example, offset is evaluated in run method as '<code>readOffset</code>'. Do I need to play with that? For e.g. I can use <code>LatestTime()</code> instead of <code>EarliestTime()</code> and in case of false, I will reset the offset to the one before using <code>offset - 1</code>. </p>
  
  <p>Is this how I should proceed? </p>