Q:Using kafka-python, is it possible to read a specific range of offsets for given partition(s)?
I looked through the documentation of the available consumers at http://kafka-python.readthedocs.org/en/1.0.0/apidoc/kafka.consumer.html but could not find anything that would let me do that.
A: How about:
consumer = KafkaConsumer() partition = TopicPartition('foo', 0) start = 1234 end = 2345 consumer.assign([partition]) consumer.seek(partition, start) for msg in consumer: if msg.offset > end: break else: print msg
Reference:
https://github.com/dpkp/kafka-python/issues/648