Skip to content

KeyError Creating SimpleProducer #113

Closed
@herriojr

Description

@herriojr

This is an issue I've been experiencing running Master branch. Basically, the first time I access an uncreated topic, I get a KeyError, whereas the second time, I can access it just fine.

import kafka
client = kafka.client.KafkaClient(address, port)
producer = kafka.producer.SimpleProducer(client, "test") # Fails first time called, succeeds thereafter

Traceback (most recent call last):
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 1532, in
debugger.run(setup['file'], None, None)
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 1143, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/projects/scratch/init.py", line 27, in
main()
File "/home/vagrant/.virtualenvs/app/local/lib/python2.7/site-packages/kafka/producer.py", line 191, in init
self.next_partition = cycle(client.topic_partitions[topic])
KeyError: 'test'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions