sclasen / akka-kafka

185 stars 62 forks source link

Question: Consuming from start of a topic #22

Closed sergmor closed 9 years ago

sergmor commented 9 years ago

Hi Scott, Cheers on the implementation it works great. Had a simple question, is there any configuration setting so that the AkkaConsumer will start at the beginning of a topic every time? (Something like the --from-beginning in the Kafka console java consumer) Thanks!

sclasen commented 9 years ago

So when you are doing this, you clearly dont care about committing offsets to kafka, so you can accomplish this by using a CommitConfig(None,None) in your AkkaConsumerProps.

Then you will configure the underlying consumer to do what you want.

The defaults are here https://github.com/sclasen/akka-kafka/blob/master/src/main/resources/reference.conf

So to add some config, you would add this to your application.conf

kafka.consumer{
  auto.offset.reset = "smallest"
}

let me know if this works for you.

If you already have offsets saved for the consumerId you are using, you should remove those from zookeeper or pick a new consumerId.

Cheers!

sergmor commented 9 years ago

Thanks! Worked perfectly!

sclasen commented 9 years ago

:+1: