Skip to content

Do not return control batch records #135

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions kafka/consumer/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,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
Loading