From 91c941ad857aa3f5058d078452ddd6149c90dcec Mon Sep 17 00:00:00 2001 From: Colin Dickson Date: Tue, 22 Jan 2013 07:17:37 -0500 Subject: [PATCH] Add offset parameter to Consumer class which allows user to consume from a previously saved spot --- kafka/consumer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kafka/consumer.py b/kafka/consumer.py index ae72add..4ad4118 100644 --- a/kafka/consumer.py +++ b/kafka/consumer.py @@ -13,7 +13,7 @@ class Consumer(kafka.io.IO): # seconds. DEFAULT_POLLING_INTERVAL = 2 - def __init__(self, topic, partition=0, host='localhost', port=9092): + def __init__(self, topic, partition=0, offset=0, host='localhost', port=9092): kafka.io.IO.__init__(self, host, port) #: The topic queue to consume. @@ -23,7 +23,7 @@ def __init__(self, topic, partition=0, host='localhost', port=9092): self.partition = partition #: Offset in the Kafka queue in bytes? - self.offset = 0 + self.offset = offset #: Maximum message size to consume. self.max_size = self.MAX_SIZE