Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Can a new Consumer start from a specified offset? #71

Closed
kchristidis opened this issue Aug 23, 2016 · 3 comments
Closed

Can a new Consumer start from a specified offset? #71

kchristidis opened this issue Aug 23, 2016 · 3 comments

Comments

@kchristidis
Copy link

kchristidis commented Aug 23, 2016

Is there an API in this library that allows this?

I'm looking for something that basically taps into sarama's ConsumePartition() API and its offset argument.

Thank you.

@kchristidis
Copy link
Author

So far, this is the only way I can make it work: Wait for a subscription to the topic/partition to be established, and once the partition consumer is launched, I MarkPartitionOffset() with offset-1 and then CommitOffsets(). Is the norm?

And if it is, assume I now want to start from sarama.OffsetOldest or sarama.OffsetNewest - how would I go about doing that? (Besides creating a new consumer in an entirely different consumer group.)

@dim
Copy link
Member

dim commented Aug 24, 2016

Hey Kostas, there is no API for this in sarama-cluster, which is really all about coordinating consumption of a continuous topic. For lower-level tasks, please take a look at sarama itself, where you can manipulate partition offsets for a consumer group. In case you want to reset them, just commit the offset for each partition with a really short RetentionTime (e.g. 0 or 1, it's in seconds), which means it will be wiped after that time and you can start with a clean sheet. Hope that helps!

@dim dim closed this as completed Aug 24, 2016
@kchristidis
Copy link
Author

kchristidis commented Aug 24, 2016

Gotcha. Thanks for the pointer!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants