wvanbergen / kafka

Load-balancing, resuming Kafka consumer for go, backed by Zookeeper.
MIT License
373 stars 141 forks source link

Retry claiming partitions if the partition is already claims. See #62 #68

Closed nemosupremo closed 9 years ago

nemosupremo commented 9 years ago

This should fix #62, and combined with the fix in PR #63, should also fix #60.

What I've opted to do is simply retry ClaimPartition 3 times, sleeping for 1sec if the error kazoo.ErrPartitionClaimedByOther occurs. If another error occurs, we exit as normal.

The other changes (line 366, 371) were due to go fmt.

wvanbergen commented 9 years ago

Ideally, I would like to use zookeeper watches instead of retrying. This way we can just wait until the partition becomes available, and resume execution then. What do you think?

This is the approach I took for my Ruby consumer

wvanbergen commented 9 years ago

I've decided to go with the watch approach in the reimplementation (see #72). For now I'll merge this as a nice addition for the current version :+1: