Skip to content

seek - needs poll #373

@numenory

Description

@numenory

Seek fails unless a poll is done first:

from confluent_kafka import Consumer, KafkaError, TopicPartition
c = Consumer({
    'bootstrap.servers': 'localhost',
    'group.id': 'bob-group',        
    'default.topic.config': {
        'auto.offset.reset': 'smallest',
    }
})

c.subscribe(['topic-test'])
tp = TopicPartition('topic-test', 0, 10)
#msg = c.poll() #shouldn't be necessary think fault in client
c.seek(tp)

Results in:

Traceback (most recent call last):
  File "kafka.confluent.consumer.py", line 29, in <module>
    c.seek(tp)
cimpl.KafkaException: KafkaError{code=_UNKNOWN_PARTITION,val=-190,str="Failed to seek to offset 10: Local: Unknown partition"}

By uncommenting the line "msg = c.poll()", the seek will succeed.

System Info:

Ubuntu 16.04

confluent-kafka-0.11.4
kafka_2.11-1.1.0.tgz
zookeeperd 3.4.10-3 (installed via apt)

Metadata

Metadata

Assignees

Labels

enhancementRequesting a feature changequestionA question about how to use or about expected behavior of the library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions