summaryrefslogtreecommitdiff
path: root/kafka/producer.py
diff options
context:
space:
mode:
authorMahendra M <mahendra.m@gmail.com>2013-10-08 14:46:02 +0530
committerMahendra M <mahendra.m@gmail.com>2013-10-08 14:46:02 +0530
commitceee715fc7bf17b28ff5a10f1f7decc8974f6506 (patch)
treeb4f36216f41b1843aa71b3354f3560b3721023a7 /kafka/producer.py
parent92d70e7310b5519a1be86f189a4ddb9d772a0434 (diff)
downloadkafka-python-ceee715fc7bf17b28ff5a10f1f7decc8974f6506.tar.gz
Add proper string representations for each class
Diffstat (limited to 'kafka/producer.py')
-rw-r--r--kafka/producer.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/kafka/producer.py b/kafka/producer.py
index 7ef7896..8275701 100644
--- a/kafka/producer.py
+++ b/kafka/producer.py
@@ -198,6 +198,9 @@ class SimpleProducer(Producer):
partition = self.next_partition.next()
return super(SimpleProducer, self).send_messages(partition, *msg)
+ def __repr__(self):
+ return '<SimpleProducer topic=%s, batch=%s>' % (self.topic, self.async)
+
class KeyedProducer(Producer):
"""
@@ -239,3 +242,6 @@ class KeyedProducer(Producer):
partitions = self.client.topic_partitions[self.topic]
partition = self.partitioner.partition(key, partitions)
return self.send_messages(partition, msg)
+
+ def __repr__(self):
+ return '<KeyedProducer topic=%s, batch=%s>' % (self.topic, self.async)