File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -254,8 +254,11 @@ def close(self):
254254
255255 def copy (self ):
256256 """
257- Create an inactive copy of the client object
258- A reinit() has to be done on the copy before it can be used again
257+ Create an inactive copy of the client object, suitable for passing
258+ to a separate thread.
259+
260+ Note that the copied connections are not initialized, so reinit() must
261+ be called on the returned copy.
259262 """
260263 c = copy .deepcopy (self )
261264 for key in c .conns :
Original file line number Diff line number Diff line change @@ -161,9 +161,11 @@ def recv(self, request_id):
161161
162162 def copy (self ):
163163 """
164- Create an inactive copy of the connection object
165- A reinit() has to be done on the copy before it can be used again
166- return a new KafkaConnection object
164+ Create an inactive copy of the connection object, suitable for
165+ passing to a background thread.
166+
167+ The returned copy is not connected; you must call reinit() before
168+ using.
167169 """
168170 c = copy .deepcopy (self )
169171 # Python 3 doesn't copy custom attributes of the threadlocal subclass
Original file line number Diff line number Diff line change @@ -206,6 +206,8 @@ class Producer(object):
206206
207207 Arguments:
208208 client (KafkaClient): instance to use for broker communications.
209+ If async=True, the background thread will use client.copy(),
210+ which is expected to return a thread-safe object.
209211 codec (kafka.protocol.ALL_CODECS): compression codec to use.
210212 req_acks (int, optional): A value indicating the acknowledgements that
211213 the server must receive before responding to the request,
You can’t perform that action at this time.
0 commit comments