DataDog/pykafka — pull request #1 by ormsbee (2011-10-17 04:24:28+00:00)
Title: Convenience

Added a Topic class to make reading messages more convenient, and shove more Kafka-logic out of our apps.

A basic summary of what's been added:

dog_queue = Kafka().topic('good_dogs')
print "Latest offset: {0}".format(dog_queue.latest_offset())
for status, messages in dog_queue.poll(offset, poll_interval=5):
for message in messages:
dog, bark = parse_barking(message)
print "{0} barked: {1}!".format(dog, bark)
print "Count of barks received: {0}".format(status.messages_read)
print "Total barking received: {0}".format(status.bytes_read)

Hasn't been tested with the Tornado stuff.