forked from IBM/sarama
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow consumer configuration to specify replica selector
Rather than always using the leader partition, this lets the consumer application specify a function to select which broker they wish to consume from. The function has the signature fn(topic string, partition int32, client Client) (*Broker, error) Allowing the client to implement their own logic for broker slection. If none is specified, the default behavior is backwards compatible and selects the leader. This pulls some changes from IBM#1696, but in our use case we want to spread the load across multiple replicas, not pick based on geographic considerations. I didn't think our specific use case made sense for the general library, but it also wasn't possible without changes to Sarama, so I made a generalizable solution. It might be possible to implement the changes for KIP-392 as a ReplicaSelector function, though that may still require some additional code changes to support communications regarding which broker should be used for a given rack.
- Loading branch information
Showing
6 changed files
with
125 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters