mumrah/kafka-python — pull request #91 by cosbynator (2014-01-08 03:55:05+00:00)
Title: No infinite loops during metadata requests, invalidate metadata more, exception hierarchy

As issue #68 suggests, you can run into an infinite loop with this client if your partition has no leader assigned. This failure scenario should be pushed into the caller since they can handle it in different ways (i.e. retry with a different partition, page the on-call). This pull request primarily addresses the issue (see the new load_metadata_for_topics that has no sleeps).

I've also created an exception hierarchy so that the client can differentiate between Kafka errors and other errors when they handle issues.

Finally, using this hierarchy, I invalidate the topic metadata properly if we send a message to the wrong broker.

Integration tests pass after creating a setUp() method that warms the partition.