Skip to content

Commit

Permalink
Skip control batches (dpkp#2361)
Browse files Browse the repository at this point in the history
  • Loading branch information
JayH5 committed Aug 14, 2023
1 parent fb00adb commit 4f4c205
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kafka/consumer/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,13 @@ def _unpack_message_set(self, tp, records):
except AttributeError:
pass

# Control messages are used to enable transactions in Kafka and are generated by the
# broker. Clients should not return control batches (ie. those with this bit set) to
# applications. (since 0.11.0.0)
if getattr(batch, "is_control_batch", False):
batch = records.next_batch()
continue

for record in batch:
key_size = len(record.key) if record.key is not None else -1
value_size = len(record.value) if record.value is not None else -1
Expand Down

0 comments on commit 4f4c205

Please sign in to comment.