Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle New Topic Creation #174

Merged
merged 2 commits into from
Aug 11, 2014
Merged

Handle New Topic Creation #174

merged 2 commits into from
Aug 11, 2014

Conversation

wizzat
Copy link
Collaborator

@wizzat wizzat commented May 22, 2014

Adds ensure_topic_exists to KafkaClient, redirects test case to use
that. Fixes #113 and fixes #150.

Adds ensure_topic_exists to KafkaClient, redirects test case to use
that.  Fixes dpkp#113 and fixes dpkp#150.
if time.time() > start_time + timeout:
raise KafkaTimeoutError("Unable to create topic {}".format(topic))
self.load_metadata_for_topics(topic)
time.sleep(.5)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sleep time should probably also be a param that users can override

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea. I'll get back to this based on the style review in the other conversation as soon as the world isn't literally blowing up at work.

@jshaw86 jshaw86 mentioned this pull request Jul 18, 2014
@dpkp
Copy link
Owner

dpkp commented Jul 18, 2014

@wizzat: are you ok with just merging this as is? The timing parameter is not critical and would be good to clean this up. If you've got a revision in the works I'll wait for it. Otherwise I feel like we should merge now.

@wizzat
Copy link
Collaborator Author

wizzat commented Jul 18, 2014

There was some discussion about making this automatically happen as it does with the Java client. It turns out that you can tell whether the topic is created and whether or not autocreate is on based on the error returned from the Kafka server when you emit the produce request. The problem is that making a produce request will require some fairly significant restructuring of some internals. I started that work, but it's not anywhere near complete.

dpkp added a commit that referenced this pull request Aug 11, 2014
Handle New Topic Creation
@dpkp dpkp merged commit c37dc89 into dpkp:master Aug 11, 2014
self.load_metadata_for_topics(topic)
while not self.has_metadata_for_topic(topic):
if time.time() > start_time + timeout:
raise KafkaTimeoutError("Unable to create topic {}".format(topic))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is KafkaTimeoutError defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sending messages to new topics fails KeyError Creating SimpleProducer
3 participants