kafka-python 2.2.0__py2.py3-none-any.whl → 2.2.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kafka/conn.py +12 -3
- kafka/consumer/group.py +2 -2
- kafka/version.py +1 -1
- {kafka_python-2.2.0.dist-info → kafka_python-2.2.1.dist-info}/METADATA +24 -1
- {kafka_python-2.2.0.dist-info → kafka_python-2.2.1.dist-info}/RECORD +7 -7
- {kafka_python-2.2.0.dist-info → kafka_python-2.2.1.dist-info}/WHEEL +0 -0
- {kafka_python-2.2.0.dist-info → kafka_python-2.2.1.dist-info}/top_level.txt +0 -0
kafka/conn.py
CHANGED
|
@@ -301,6 +301,7 @@ class BrokerConnection(object):
|
|
|
301
301
|
if self.config['ssl_context'] is not None:
|
|
302
302
|
self._ssl_context = self.config['ssl_context']
|
|
303
303
|
self._api_versions_future = None
|
|
304
|
+
self._api_versions_check_timeout = self.config['api_version_auto_timeout_ms']
|
|
304
305
|
self._sasl_auth_future = None
|
|
305
306
|
self.last_attempt = 0
|
|
306
307
|
self._gai = []
|
|
@@ -557,7 +558,8 @@ class BrokerConnection(object):
|
|
|
557
558
|
else:
|
|
558
559
|
request = ApiVersionsRequest[version]()
|
|
559
560
|
future = Future()
|
|
560
|
-
|
|
561
|
+
self._api_versions_check_timeout /= 2
|
|
562
|
+
response = self._send(request, blocking=True, request_timeout_ms=self._api_versions_check_timeout)
|
|
561
563
|
response.add_callback(self._handle_api_versions_response, future)
|
|
562
564
|
response.add_errback(self._handle_api_versions_failure, future)
|
|
563
565
|
self._api_versions_future = future
|
|
@@ -566,7 +568,8 @@ class BrokerConnection(object):
|
|
|
566
568
|
elif self._check_version_idx < len(self.VERSION_CHECKS):
|
|
567
569
|
version, request = self.VERSION_CHECKS[self._check_version_idx]
|
|
568
570
|
future = Future()
|
|
569
|
-
|
|
571
|
+
self._api_versions_check_timeout /= 2
|
|
572
|
+
response = self._send(request, blocking=True, request_timeout_ms=self._api_versions_check_timeout)
|
|
570
573
|
response.add_callback(self._handle_check_version_response, future, version)
|
|
571
574
|
response.add_errback(self._handle_check_version_failure, future)
|
|
572
575
|
self._api_versions_future = future
|
|
@@ -618,7 +621,13 @@ class BrokerConnection(object):
|
|
|
618
621
|
|
|
619
622
|
def _handle_api_versions_failure(self, future, ex):
|
|
620
623
|
future.failure(ex)
|
|
621
|
-
|
|
624
|
+
# Modern brokers should not disconnect on unrecognized api-versions request,
|
|
625
|
+
# but in case they do we always want to try v0 as a fallback
|
|
626
|
+
# otherwise switch to check_version probe.
|
|
627
|
+
if self._api_versions_idx > 0:
|
|
628
|
+
self._api_versions_idx = 0
|
|
629
|
+
else:
|
|
630
|
+
self._check_version_idx = 0
|
|
622
631
|
# after failure connection is closed, so state should already be DISCONNECTED
|
|
623
632
|
|
|
624
633
|
def _handle_check_version_response(self, future, version, _response):
|
kafka/consumer/group.py
CHANGED
|
@@ -877,7 +877,7 @@ class KafkaConsumer(six.Iterator):
|
|
|
877
877
|
|
|
878
878
|
for tp in partitions:
|
|
879
879
|
log.debug("Seeking to beginning of partition %s", tp)
|
|
880
|
-
self._subscription.
|
|
880
|
+
self._subscription.request_offset_reset(tp, OffsetResetStrategy.EARLIEST)
|
|
881
881
|
self._iterator = None
|
|
882
882
|
|
|
883
883
|
def seek_to_end(self, *partitions):
|
|
@@ -902,7 +902,7 @@ class KafkaConsumer(six.Iterator):
|
|
|
902
902
|
|
|
903
903
|
for tp in partitions:
|
|
904
904
|
log.debug("Seeking to end of partition %s", tp)
|
|
905
|
-
self._subscription.
|
|
905
|
+
self._subscription.request_offset_reset(tp, OffsetResetStrategy.LATEST)
|
|
906
906
|
self._iterator = None
|
|
907
907
|
|
|
908
908
|
def subscribe(self, topics=(), pattern=None, listener=None):
|
kafka/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.2.
|
|
1
|
+
__version__ = '2.2.1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kafka-python
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.1
|
|
4
4
|
Summary: Pure Python client for Apache Kafka
|
|
5
5
|
Author-email: Dana Powers <dana.powers@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/dpkp/kafka-python
|
|
@@ -138,6 +138,14 @@ that expose basic message attributes: topic, partition, offset, key, and value:
|
|
|
138
138
|
for msg in consumer:
|
|
139
139
|
print (msg.headers)
|
|
140
140
|
|
|
141
|
+
.. code-block:: python
|
|
142
|
+
|
|
143
|
+
# Read only committed messages from transactional topic
|
|
144
|
+
consumer = KafkaConsumer(isolation_level='read_committed')
|
|
145
|
+
consumer.subscribe(['txn_topic'])
|
|
146
|
+
for msg in consumer:
|
|
147
|
+
print(msg)
|
|
148
|
+
|
|
141
149
|
.. code-block:: python
|
|
142
150
|
|
|
143
151
|
# Get consumer metrics
|
|
@@ -197,6 +205,21 @@ for more details.
|
|
|
197
205
|
for i in range(1000):
|
|
198
206
|
producer.send('foobar', b'msg %d' % i)
|
|
199
207
|
|
|
208
|
+
.. code-block:: python
|
|
209
|
+
|
|
210
|
+
# Use transactions
|
|
211
|
+
producer = KafkaProducer(transactional_id='fizzbuzz')
|
|
212
|
+
producer.init_transactions()
|
|
213
|
+
producer.begin_transaction()
|
|
214
|
+
future = producer.send('txn_topic', value=b'yes')
|
|
215
|
+
future.get() # wait for successful produce
|
|
216
|
+
producer.commit_transaction() # commit the transaction
|
|
217
|
+
|
|
218
|
+
producer.begin_transaction()
|
|
219
|
+
future = producer.send('txn_topic', value=b'no')
|
|
220
|
+
future.get() # wait for successful produce
|
|
221
|
+
producer.abort_transaction() # abort the transaction
|
|
222
|
+
|
|
200
223
|
.. code-block:: python
|
|
201
224
|
|
|
202
225
|
# Include record headers. The format is list of tuples with string key
|
|
@@ -2,13 +2,13 @@ kafka/__init__.py,sha256=4dvHKZAxmD_4tfJ5wGcRV2X78vPcm8vsUoqceULevjA,1077
|
|
|
2
2
|
kafka/client_async.py,sha256=joZB3AnL1mLwvV5fv61Pqn8mkP90FVvzcZ2tZsTGmvM,57060
|
|
3
3
|
kafka/cluster.py,sha256=f9VNkWanz8X2Rn67XDdmunfx5aJ4s35JUsF5VYJ5hvk,16143
|
|
4
4
|
kafka/codec.py,sha256=8NZpnehzNrhSBIjzbPVSvyFbSeLAqEntE7BfVHu-_9I,10036
|
|
5
|
-
kafka/conn.py,sha256=
|
|
5
|
+
kafka/conn.py,sha256=IdWJTEYTalvsmnT74P0eu1Jzx6YdPyemvQovRoBQ8NM,70019
|
|
6
6
|
kafka/errors.py,sha256=J3R7z2hkbWA1hsD-bGHdRjcz6BYjP6RNVSQswA2UMmE,33749
|
|
7
7
|
kafka/future.py,sha256=ZQStbfUYIPJRrgMfAWxxjrIRVxsw4WCtSR0J0bkyGno,2847
|
|
8
8
|
kafka/socks5_wrapper.py,sha256=6woOaCTJXJ5e89_zdyW5BjOpyE4rCbYFH-kd-FeuPuk,9827
|
|
9
9
|
kafka/structs.py,sha256=SJGzmLdV21jZyQ7247k0WFy16UiusgTHK3I-e4qzI-E,3058
|
|
10
10
|
kafka/util.py,sha256=LV6BlELC8-889FpWM1RECX25sccoVrY2U0r5dRZjLNo,3781
|
|
11
|
-
kafka/version.py,sha256
|
|
11
|
+
kafka/version.py,sha256=-7agX4LcQ0956RU4mY0EYyxYQU9llH7JklZOsqoujdU,22
|
|
12
12
|
kafka/admin/__init__.py,sha256=S_XxqyyV480_yXhttK79XZqNAmZyXRjspd3SoqYykE8,720
|
|
13
13
|
kafka/admin/acl_resource.py,sha256=ak_dUsSni4SyP0ORbSKenZpwTy0Ykxq3FSt_9XgLR8k,8265
|
|
14
14
|
kafka/admin/client.py,sha256=Mg0iuTFLOwc34JNQs99JvC0uDI_ZwZhF7x2jaEVstT4,78933
|
|
@@ -24,7 +24,7 @@ kafka/benchmarks/record_batch_read.py,sha256=vlFaWU2YWI379n_2M8qieb_S2uHUWKV0Nqu
|
|
|
24
24
|
kafka/benchmarks/varint_speed.py,sha256=s4CuvKgDZL-_zna5E3vM8RgHjhXuW6pcaO1z1WYZ_0Y,12585
|
|
25
25
|
kafka/consumer/__init__.py,sha256=NDdvtyuJgFyQZahqL9i5sYXGP6rOMIXWwHQEaZ1fCcs,122
|
|
26
26
|
kafka/consumer/fetcher.py,sha256=0SUg8_8W0b-sVDg8dMq06ydR3P_mIGvUwxfbYI8cUIE,67963
|
|
27
|
-
kafka/consumer/group.py,sha256=
|
|
27
|
+
kafka/consumer/group.py,sha256=Jvoal4SdOniweXeUhhYR_HxDUJmmUiKf4WrI_tuJfCQ,58857
|
|
28
28
|
kafka/consumer/subscription_state.py,sha256=f_qJQMhTWQnUd_7lPj43gsagWSKGEmP4jpnEwA6s1Ec,23661
|
|
29
29
|
kafka/coordinator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
kafka/coordinator/base.py,sha256=a6GZKCz4kHKxHNhvwQXr2cTVKm3PH5A-ybDBIN_Dr3Y,50640
|
|
@@ -120,7 +120,7 @@ kafka/vendor/enum34.py,sha256=-u-lxAiJMt6ru4Do7NUDY9OpeWkYJMksb2xengJawFE,31204
|
|
|
120
120
|
kafka/vendor/selectors34.py,sha256=gxejLO4eXf8mRSGXaQiknPig3GdX1rtsZiYOQJVuAy8,20594
|
|
121
121
|
kafka/vendor/six.py,sha256=lLBa9_HrANP5BMZ7twEzg1M3wofwPmXyptuWmHX0brY,34826
|
|
122
122
|
kafka/vendor/socketpair.py,sha256=Fi3PoY1Okkppab720wFk1BhHXyjcw7hi5DwhqrYZH2Y,2737
|
|
123
|
-
kafka_python-2.2.
|
|
124
|
-
kafka_python-2.2.
|
|
125
|
-
kafka_python-2.2.
|
|
126
|
-
kafka_python-2.2.
|
|
123
|
+
kafka_python-2.2.1.dist-info/METADATA,sha256=zgYWaouiO6KsqTYxb5PQi5LbEk9iSzttcvJjBq3ie7Q,9951
|
|
124
|
+
kafka_python-2.2.1.dist-info/WHEEL,sha256=XAkygS4h1cf0JYWV13kJhTWht2y9NqKAsZuiTHc2920,109
|
|
125
|
+
kafka_python-2.2.1.dist-info/top_level.txt,sha256=IivJz7l5WHdLNDT6RIiVAlhjQzYRwGqBBmKHZ7WjPeM,6
|
|
126
|
+
kafka_python-2.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|