kafka-go icon indicating copy to clipboard operation
kafka-go copied to clipboard

Partition rebalancing

Open intouchkey opened this issue 3 years ago • 2 comments

ConsumerRebalance Listener methods implementations in kafka-go

Is there a way for me to flush and commit offsets on partitions revoked?

Additional questions (sorry I'm really new to this lib):

  1. Is it possible for us to set other configs? For example: enable.auto.commit to false?

intouchkey avatar May 31 '21 02:05 intouchkey

You need to use the consumergroup API. See an example here:

https://github.com/segmentio/kafka-go/blob/master/example_consumergroup_test.go

dmarkhas avatar Jun 10 '21 14:06 dmarkhas

@intouchkey Yes, @dmarkhas provided a good example of how to use consumer groups, and there is some additional documentation here on how it works as well https://pkg.go.dev/github.com/segmentio/kafka-go#ConsumerGroup

We don't have support for setting enable.auto.commit but we do support similar functionality via explicit commits https://github.com/segmentio/kafka-go#explicit-commits

Let me know if this answers your questions!

nlsun avatar Jun 26 '21 03:06 nlsun