diff options
author | Dana Powers <dana.powers@gmail.com> | 2019-03-23 18:31:34 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2019-03-23 18:31:34 -0700 |
commit | e64418e999db5e55ab2cdc62293f740bf03556b1 (patch) | |
tree | 498fd84ea98018e54c1d51192eb25c62b3d19bf5 /kafka/protocol | |
parent | ce9c1d2e2b8d85b2f6c3b2a2ebd280246cfea07f (diff) | |
download | kafka-python-0_8_2_protocol_parser_too.tar.gz |
Revert 703f0659 / fix 0.8.2 protocol quick detection0_8_2_protocol_parser_too
Diffstat (limited to 'kafka/protocol')
-rw-r--r-- | kafka/protocol/parser.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kafka/protocol/parser.py b/kafka/protocol/parser.py index a99b3ae..cfee046 100644 --- a/kafka/protocol/parser.py +++ b/kafka/protocol/parser.py @@ -18,6 +18,12 @@ class KafkaProtocol(object): Use an instance of KafkaProtocol to manage bytes send/recv'd from a network socket to a broker. + + Arguments: + client_id (str): identifier string to be included in each request + api_version (tuple): Optional tuple to specify api_version to use. + Currently only used to check for 0.8.2 protocol quirks, but + may be used for more in the future. """ def __init__(self, client_id=None, api_version=None): if client_id is None: @@ -141,10 +147,10 @@ class KafkaProtocol(object): (correlation_id, request) = self.in_flight_requests.popleft() # 0.8.2 quirk - if (self._api_version == (0, 8, 2) and - request.RESPONSE_TYPE is GroupCoordinatorResponse[0] and + if (recv_correlation_id == 0 and correlation_id != 0 and - recv_correlation_id == 0): + request.RESPONSE_TYPE is GroupCoordinatorResponse[0] and + (self._api_version == (0, 8, 2) or self._api_version is None)): log.warning('Kafka 0.8.2 quirk -- GroupCoordinatorResponse' ' Correlation ID does not match request. This' ' should go away once at least one topic has been' |