Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make list of brokers available through sarama.Client #813

Merged
merged 3 commits into from
Jan 27, 2017
Merged

make list of brokers available through sarama.Client #813

merged 3 commits into from
Jan 27, 2017

Conversation

hollow
Copy link
Contributor

@hollow hollow commented Jan 25, 2017

Useful in general, but needed to iterate through all brokers and get consumer group offsets.

@eapache
Copy link
Contributor

eapache commented Jan 26, 2017

needed to iterate through all brokers and get consumer group offsets

I'm not sure I understand this use case. Client.Coordinator can already be used to retrieve the broker for a specific consumer group.

Tangential note: you should be able to use https://golang.org/pkg/builtin/#copy instead of manually looping over the array.

@hollow
Copy link
Contributor Author

hollow commented Jan 27, 2017

I'm not sure I understand this use case. Client.Coordinator can already be used to retrieve the broker for a specific consumer group.

The use case is to retrieve all consumer groups from all brokers with Broker.ListGroups without knowing the groups in advance.

Tangential note: you should be able to use https://golang.org/pkg/builtin/#copy instead of manually looping over the array.

This only works with slices, but client.brokers is a map.

@eapache
Copy link
Contributor

eapache commented Jan 27, 2017

This only works with slices, but client.brokers is a map.

Oops, my mistake.

The use case is to retrieve all consumer groups from all brokers with Broker.ListGroups without knowing the groups in advance.

Cool, makes sense. You need to hold the read lock (client.lock.RLock()) before reading client.brokers, otherwise this looks good.

@hollow
Copy link
Contributor Author

hollow commented Jan 27, 2017

You need to hold the read lock (client.lock.RLock()) before reading client.brokers

thanks, fixed :)

@eapache eapache merged commit 574d314 into IBM:master Jan 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants