Skip to content
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

KafkaConsumer.task_done: warn and skip unrecognized topic-partitions #389

Merged
merged 1 commit into from
Jun 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions kafka/consumer/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,16 @@ def task_done(self, message):
message (KafkaMessage): the message to mark as complete

Returns:
Nothing

True, unless the topic-partition for this message has not
been configured for the consumer. In normal operation, this
should not happen. But see github issue 364.
"""
topic_partition = (message.topic, message.partition)
if topic_partition not in self._topics:
logger.warning('Unrecognized topic/partition in task_done message: '
'{0}:{1}'.format(*topic_partition))
return False

offset = message.offset

# Warn on non-contiguous offsets
Expand All @@ -476,6 +482,8 @@ def task_done(self, message):
if self._should_auto_commit():
self.commit()

return True

def commit(self):
"""Store consumed message offsets (marked via task_done())
to kafka cluster for this consumer_group.
Expand Down