Skip to content

Commit 4f4c205

Browse files
committed
Skip control batches (dpkp#2361)
1 parent fb00adb commit 4f4c205

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kafka/consumer/fetcher.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,13 @@ def _unpack_message_set(self, tp, records):
464464
except AttributeError:
465465
pass
466466

467+
# Control messages are used to enable transactions in Kafka and are generated by the
468+
# broker. Clients should not return control batches (ie. those with this bit set) to
469+
# applications. (since 0.11.0.0)
470+
if getattr(batch, "is_control_batch", False):
471+
batch = records.next_batch()
472+
continue
473+
467474
for record in batch:
468475
key_size = len(record.key) if record.key is not None else -1
469476
value_size = len(record.value) if record.value is not None else -1

0 commit comments

Comments
 (0)