Confluent's Apache Kafka client for Python
Project description
Confluent's Apache Kafka client for Python
==========================================
Confluent's Kafka client for Python wraps the librdkafka C library, providing
full Kafka protocol support with great performance and reliability.
The Python bindings provides a high-level Producer and Consumer with support
for the balanced consumer groups of Apache Kafka 0.9.
See the [API documentation](http://docs.confluent.io/current/clients/confluent-kafka-python/index.html) for more info.
**License**: [Apache License v2.0](http://www.apache.org/licenses/LICENSE-2.0)
Usage
=====
**Producer:**
```python
from confluent_kafka import Producer
p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
for data in some_data_source:
p.produce('mytopic', data.encode('utf-8'))
p.flush()
```
**High-level Consumer:**
```python
from confluent_kafka import Consumer
c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
c.subscribe(['mytopic'])
while running:
msg = c.poll()
if not msg.error():
print('Received message: %s' % msg.value().decode('utf-8'))
c.close()
```
See [examples](examples) for more examples.
Prerequisites
=============
* Python >= 2.7 or Python 3.x
* [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.1
Install
=======
**Install from PyPi:**
$ pip install confluent-kafka
**Install from source / tarball:**
$ pip install .
Build
=====
$ python setup.by build
If librdkafka is installed in a non-standard location provide the include and library directories with:
$ CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...
Tests
=====
**Run unit-tests:**
$ py.test
**NOTE**: Requires `py.test`, install by `pip install pytest`
**Run integration tests:**
$ examples/integration_test.py <kafka-broker>
**WARNING**: These tests require an active Kafka cluster and will make use of a topic named 'test'.
Generate documentation
======================
Install sphinx and sphinx_rtd_theme packages and then:
$ make docs
or:
$ python setup.by build_sphinx
Documentation will be generated in `docs/_build/`.
==========================================
Confluent's Kafka client for Python wraps the librdkafka C library, providing
full Kafka protocol support with great performance and reliability.
The Python bindings provides a high-level Producer and Consumer with support
for the balanced consumer groups of Apache Kafka 0.9.
See the [API documentation](http://docs.confluent.io/current/clients/confluent-kafka-python/index.html) for more info.
**License**: [Apache License v2.0](http://www.apache.org/licenses/LICENSE-2.0)
Usage
=====
**Producer:**
```python
from confluent_kafka import Producer
p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
for data in some_data_source:
p.produce('mytopic', data.encode('utf-8'))
p.flush()
```
**High-level Consumer:**
```python
from confluent_kafka import Consumer
c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
c.subscribe(['mytopic'])
while running:
msg = c.poll()
if not msg.error():
print('Received message: %s' % msg.value().decode('utf-8'))
c.close()
```
See [examples](examples) for more examples.
Prerequisites
=============
* Python >= 2.7 or Python 3.x
* [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.1
Install
=======
**Install from PyPi:**
$ pip install confluent-kafka
**Install from source / tarball:**
$ pip install .
Build
=====
$ python setup.by build
If librdkafka is installed in a non-standard location provide the include and library directories with:
$ CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...
Tests
=====
**Run unit-tests:**
$ py.test
**NOTE**: Requires `py.test`, install by `pip install pytest`
**Run integration tests:**
$ examples/integration_test.py <kafka-broker>
**WARNING**: These tests require an active Kafka cluster and will make use of a topic named 'test'.
Generate documentation
======================
Install sphinx and sphinx_rtd_theme packages and then:
$ make docs
or:
$ python setup.by build_sphinx
Documentation will be generated in `docs/_build/`.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
confluent-kafka-0.9.1.2.tar.gz
(25.5 kB
view details)
File details
Details for the file confluent-kafka-0.9.1.2.tar.gz
.
File metadata
- Download URL: confluent-kafka-0.9.1.2.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b75613c9a5f35f02b8205fe248b956c83a7654ba179ef48d3306c99d37179ed |
|
MD5 | adaa7ed78bf00fdbb928cef6dd170ed7 |
|
BLAKE2b-256 | 2b4863278a8b857805f5459caa06f1bc881c5022e2c1c9e9e9751310d986b73e |