Skip to content

Commit 03136d5

Browse files
authored
Merge pull request confluentinc#382 from confluentinc/adminapi
Topic Admin API, list_topics(), Python 3.7, fixes
2 parents 3546419 + 8d1e8d3 commit 03136d5

24 files changed

+4907
-213
lines changed

.travis.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,12 @@ matrix:
66
dist: trusty
77
python: "2.7"
88
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=master
9-
# Source package verification with Python 2.7 and librdkafka v0.9.5
9+
# Source package verification with Python 3.6 and librdkafka master
1010
- os: linux
1111
language: python
1212
dist: trusty
13-
python: "2.7"
14-
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.9.5
15-
# Source package verification with Python 3.5 and librdkafka master
16-
- os: linux
17-
language: python
18-
dist: trusty
19-
python: "3.5"
20-
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.9.5
13+
python: "3.6"
14+
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=master
2115
# cibuildwheel for osx
2216
- os: osx
2317
env: CIBW_BEFORE_BUILD="tools/bootstrap-librdkafka.sh --require-ssl master tmp" CFLAGS="-Itmp/include" LDFLAGS="-Ltmp/lib"

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Prerequisites
240240
=============
241241

242242
* Python >= 2.7 or Python 3.x
243-
* [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.5 (latest release is embedded in wheels)
243+
* [librdkafka](https://github.com/edenhill/librdkafka) >= 0.11.5 (latest release is embedded in wheels)
244244

245245
librdkafka is embedded in the macosx manylinux wheels, for other platforms, SASL Kerberos/GSSAPI support or
246246
when a specific version of librdkafka is desired, following these guidelines:
@@ -277,14 +277,9 @@ In order to run full test suite, simply execute:
277277
**NOTE**: Requires `tox` (please install with `pip install tox`), several supported versions of Python on your path, and `librdkafka` [installed](tools/bootstrap-librdkafka.sh) into `tmp-build`.
278278

279279

280-
**Run integration tests:**
281-
282-
To run the integration tests, uncomment the following line from `tox.ini` and add the paths to your Kafka and Confluent Schema Registry instances. You can also run the integration tests outside of `tox` by running this command from the source root.
283-
284-
examples/integration_test.py <kafka-broker> [<test-topic>] [<schema-registry>]
285-
286-
**WARNING**: These tests require an active Kafka cluster and will create new topics.
280+
**Integration tests:**
287281

282+
See [tests/README.md](tests/README.md) for instructions on how to run integration tests.
288283

289284

290285

confluent_kafka/__init__.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__all__ = ['cimpl', 'avro', 'kafkatest']
1+
__all__ = ['cimpl', 'admin', 'avro', 'kafkatest']
22
from .cimpl import (Consumer, # noqa
33
KafkaError,
44
KafkaException,
@@ -15,5 +15,30 @@
1515
OFFSET_STORED,
1616
OFFSET_INVALID)
1717

18-
1918
__version__ = version()[0]
19+
20+
21+
class ThrottleEvent (object):
22+
"""
23+
ThrottleEvent contains details about a throttled request.
24+
Set up a throttle callback by setting the ``throttle_cb`` configuration
25+
property to a callable that takes a ThrottleEvent object as its only argument.
26+
The callback will be triggered from poll(), consume() or flush() when a request
27+
has been throttled by the broker.
28+
29+
This class is typically not user instantiated.
30+
31+
:ivar str broker_name: The hostname of the broker which throttled the request
32+
:ivar int broker_id: The broker id
33+
:ivar float throttle_time: The amount of time (in seconds) the broker throttled (delayed) the request
34+
"""
35+
def __init__(self, broker_name,
36+
broker_id,
37+
throttle_time):
38+
39+
self.broker_name = broker_name
40+
self.broker_id = broker_id
41+
self.throttle_time = throttle_time
42+
43+
def __str__(self):
44+
return "{}/{} throttled for {} ms".format(self.broker_name, self.broker_id, int(self.throttle_time * 1000))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy