summaryrefslogtreecommitdiff
path: root/kafka/client.py
diff options
context:
space:
mode:
authorDavid Arthur <mumrah@gmail.com>2012-11-19 10:29:30 -0500
committerDavid Arthur <mumrah@gmail.com>2012-11-19 20:47:27 -0500
commit330ddbca4464f32d31b662eb95b92113e7024323 (patch)
tree3869ac9b6e2b0d8718eb5576a3031b73ad315e15 /kafka/client.py
parent0c61f4467a327e38c9c8701ab680e47a209bab7c (diff)
downloadkafka-python-330ddbca4464f32d31b662eb95b92113e7024323.tar.gz
Add a Queue-like producer/consumer
Creates a producer process and one consumer process per partition. Uses `multiprocessing.Queue` for communication between the parent process and the producer/consumers. ```python kafka = KafkaClient("localhost", 9092) q = KafkaQueue(kafka, client="test-queue", partitions=[0,1]) q.put("test") q.get() q.close() kafka.close() ``` Ref #8
Diffstat (limited to 'kafka/client.py')
-rw-r--r--kafka/client.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/kafka/client.py b/kafka/client.py
index 212f5c3..c25e2d2 100644
--- a/kafka/client.py
+++ b/kafka/client.py
@@ -73,6 +73,9 @@ class KafkaClient(object):
self._sock.settimeout(10)
log.debug("Connected to %s on %d", host, port)
+ def __copy__(self):
+ return KafkaClient(self.host, self.port, self.bufsize)
+
######################
# Protocol Stuff #
######################