diff options
author | Mahendra M <mahendra.m@gmail.com> | 2013-10-07 20:29:35 -0700 |
---|---|---|
committer | Mahendra M <mahendra.m@gmail.com> | 2013-10-07 20:29:35 -0700 |
commit | 92d70e7310b5519a1be86f189a4ddb9d772a0434 (patch) | |
tree | b43b90fcdaaef0839329b20a02c79f8229773b26 /kafka/client.py | |
parent | eb2c1735f26ce11540fb92ea94817f43b9b3a798 (diff) | |
parent | f9cf62816ff2c2255d414a2d9f3dd32d8c81418b (diff) | |
download | kafka-python-92d70e7310b5519a1be86f189a4ddb9d772a0434.tar.gz |
Merge pull request #61 from mahendra/prod-windows
Ensure that async producer works in windows. Fixes #46
Diffstat (limited to 'kafka/client.py')
-rw-r--r-- | kafka/client.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kafka/client.py b/kafka/client.py index c0a3cdb..71ededa 100644 --- a/kafka/client.py +++ b/kafka/client.py @@ -1,3 +1,4 @@ +import copy from collections import defaultdict from functools import partial from itertools import count @@ -193,6 +194,16 @@ class KafkaClient(object): for conn in self.conns.values(): conn.close() + def copy(self): + """ + Create an inactive copy of the client object + A reinit() has to be done on the copy before it can be used again + """ + c = copy.deepcopy(self) + for k, v in c.conns.items(): + c.conns[k] = v.copy() + return c + def reinit(self): for conn in self.conns.values(): conn.reinit() |