summaryrefslogtreecommitdiff
path: root/kafka/consumer/kafka.py
diff options
context:
space:
mode:
authorwkiser <wkiser@gmail.com>2015-02-23 12:58:20 -0500
committerwkiser <wkiser@gmail.com>2015-03-02 13:43:53 -0500
commit6de9444b960b931d9def09e6d95ac6866bb34466 (patch)
tree446691376535a3f33463284d1561d6c5d7423fe8 /kafka/consumer/kafka.py
parent9ad0be662d388b47aadf04d712f5744add6456e3 (diff)
downloadkafka-python-6de9444b960b931d9def09e6d95ac6866bb34466.tar.gz
Fixes consumer/kafka and consumer/simple to only yield messages if the message's offset is greater than or equal to the consumer offset.
Diffstat (limited to 'kafka/consumer/kafka.py')
-rw-r--r--kafka/consumer/kafka.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/kafka/consumer/kafka.py b/kafka/consumer/kafka.py
index cd3cc4a..53ba0a7 100644
--- a/kafka/consumer/kafka.py
+++ b/kafka/consumer/kafka.py
@@ -430,6 +430,10 @@ class KafkaConsumer(object):
offset, message.key,
self._config['deserializer_class'](message.value))
+ if offset < self._offsets.fetch[topic_partition]:
+ logger.debug('Skipping message %s because its offset is less than the consumer offset',
+ msg)
+ continue
# Only increment fetch offset if we safely got the message and deserialized
self._offsets.fetch[topic_partition] = offset + 1