summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kafka/__init__.py2
-rw-r--r--kafka/client.py3
-rw-r--r--kafka/consumer.py8
-rw-r--r--kafka/producer.py6
4 files changed, 18 insertions, 1 deletions
diff --git a/kafka/__init__.py b/kafka/__init__.py
index 73aa760..5298dbf 100644
--- a/kafka/__init__.py
+++ b/kafka/__init__.py
@@ -1,5 +1,5 @@
__title__ = 'kafka'
-__version__ = '0.2-alpha'
+__version__ = '0.8.1-1'
__author__ = 'David Arthur'
__license__ = 'Apache License 2.0'
__copyright__ = 'Copyright 2012, David Arthur under Apache License, v2.0'
diff --git a/kafka/client.py b/kafka/client.py
index 71ededa..a579ef3 100644
--- a/kafka/client.py
+++ b/kafka/client.py
@@ -186,6 +186,9 @@ class KafkaClient(object):
# Order the accumulated responses by the original key order
return (acc[k] for k in original_keys) if acc else ()
+ def __repr__(self):
+ return '<KafkaClient client_id=%s>' % (self.client_id)
+
#################
# Public API #
#################
diff --git a/kafka/consumer.py b/kafka/consumer.py
index f2898ad..8a04c2a 100644
--- a/kafka/consumer.py
+++ b/kafka/consumer.py
@@ -230,6 +230,10 @@ class SimpleConsumer(Consumer):
auto_commit_every_n=auto_commit_every_n,
auto_commit_every_t=auto_commit_every_t)
+ def __repr__(self):
+ return '<SimpleConsumer group=%s, topic=%s, partitions=%s>' % \
+ (self.group, self.topic, str(self.offsets.keys()))
+
def provide_partition_info(self):
"""
Indicates that partition info must be returned by the consumer
@@ -535,6 +539,10 @@ class MultiProcessConsumer(Consumer):
proc.start()
self.procs.append(proc)
+ def __repr__(self):
+ return '<MultiProcessConsumer group=%s, topic=%s, consumers=%d>' % \
+ (self.group, self.topic, len(self.procs))
+
def stop(self):
# Set exit and start off all waiting consumers
self.exit.set()
diff --git a/kafka/producer.py b/kafka/producer.py
index 7ef7896..20d67fa 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 batch=%s, topic=%s>' % (self.async, self.topic)
+
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 batch=%s, topic=%s>' % (self.async, self.topic)