diff options
author | Jeff Widman <jeff@jeffwidman.com> | 2018-11-17 02:24:26 -0800 |
---|---|---|
committer | Jeff Widman <jeff@jeffwidman.com> | 2018-11-18 15:15:11 -0800 |
commit | ac1a2a0a1012909faba4e711b968e5b0c3746ca5 (patch) | |
tree | 894a91eab760b2d91bf174d5d15133a91faa3e1e /example.py | |
parent | d67157cb9a032a6f0493cea128bbcd0528f3e640 (diff) | |
download | kafka-python-ac1a2a0a1012909faba4e711b968e5b0c3746ca5.tar.gz |
Add group coordinator lookup
We need a way to send a request to the group coordinator.
I spent a day and a half trying to implement a `_send_request_to_group_coordinator()`
that included:
1. caching the value of the group coordinator so that it wouldn't have
to be repeatedly looked up on every call. This is particularly important
because the `list_consumer_groups()`, `list_consumer_group_offsets()`,
and `describe_consumer_groups()` will frequently be used by monitoring
scripts. I know across the production clusters that I support, using a
cached value will save ~1M calls per day.
2. clean and consistent error handling. This is difficult because the
responses are inconsistent about error codes. Some have a top-level
error code, some bury it within the description of the actual item.
3. Avoiding tight coupling between this method and the request/response
classes... the custom parsing logic for errors etc, given that it's
non-standard, should live in the callers, not here.
So finally I gave up and just went with this simpler solution and made
it so the callers can optionally bypass this if they somehow already
know the group coordinator.
Diffstat (limited to 'example.py')
0 files changed, 0 insertions, 0 deletions