-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Support for multiple hosts on KafkaClient boostrap (improves on #70) #122
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
Conversation
Conflicts: kafka/client.py kafka/conn.py setup.py test/test_integration.py test/test_unit.py
|
||
res = host_port.split(':') | ||
host = res[0] | ||
port = int(res[1]) if len(res) > 1 else 9092 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default port should be a constant: DEFAULT_KAKFA_PORT = 9092
Looks good! I just had a couple of minor comments. Thanks for all the unit test work! |
result = [] | ||
for host_port in hosts: | ||
|
||
res = host_port.split(':') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want host_port.strip().split(':')
to allow for spaces around the commas
Support for multiple hosts on KafkaClient boostrap (improves on #70)
Allow KafkaClient to take in a list of brokers for bootstrapping (improves in #70)
Proposed resolution for enhancement #25
This change breaks the KafkaClient constructor API but replacing the host and port parameters with hosts represented as a comma-separated list of host:port.
E.g. as comma-separated string of host:port
kafka = KafkaClient("localhost:9092, localhost:9093")
or as list of host:port
kafka = KafkaClient(['localhost:9092', 'localhost:9093'])
It also introduces the mock library for unit testing.
Note: some unit tests are still marked as skipped until disabling recursion on
load_metadata_for_topics
_, an issue I found during testing (#68). They are enabled in #109