I think the SimpleConsumer 
Example(https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example
 
<https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example>)
 in the wiki is a very good starting point.

You can pass in the offset to the FetchRequest. And you can ask for the latest 
offset using kafka.api.OffsetRequest.LatestTime()

> 在 2015年6月3日,上午12:25,Kevin Sjöberg <kevin.sjob...@fortnox.se> 写道:
> 
> Hello,
> 
> I'm trying to create a custom consumer that given a offset returns all
> messages until now. After this is done, the consumer is not needed anymore,
> hence, the consumer does not have to continue consuming messages that are
> being produced.
> 
> The Kafka cluster exists of one broker and we only use one partition as
> well. My understanding is that I can use the SimpleConsumer API for this,
> but I'm a bit unsure on how to go about it.
> 
> Would anyone mind helping me out or point me in the right direction?
> 
> Cheers,
> Kevin
> 
> -- 
> Kevin Sjöberg
> 
> -- 
> Du skapar din faktura, vi skickar den och ser till att kunden betalar. Vi 
> sköter allt, hela vägen tills fakturan är betald! 
> Läs om Nox Finans här 
> <https://www.fortnox.se/nox/?utm_source=signature&utm_medium=email&utm_campaign=noxfinans&utm_term=fakturahantering>
> .

Reply via email to