twmb / franz-go

franz-go contains a feature complete, pure Go library for interacting with Kafka from 0.8.0 through 3.7+. Producing, consuming, transacting, administrating, etc.
BSD 3-Clause "New" or "Revised" License
1.78k stars 182 forks source link

add ability to provide own member id #734

Closed vtolstov closed 4 months ago

vtolstov commented 4 months ago

I'm already have service id (uuid) and want to stick with it id in consumer group. What do you think?

twmb commented 4 months ago

This is where you should be using instance IDs, rather than a standard member.

Are you intending to try to restart your application quickly, plug back in the prior member ID, and avoid any rebalance? This really is exactly what instance IDs were introduced for, although they can be a bit cumbersome because it requires manual intervention to actually leave a group. Do instance IDs not suffice?

vtolstov commented 4 months ago

how i can use InstanceID ? does it possible to assign it from client opt ?

twmb commented 4 months ago

Yep, https://pkg.go.dev/github.com/twmb/franz-go/pkg/kgo#InstanceID

Since InstanceID should solve this, I'll close the issue now.