Skip to content

Commit 3d9d981

Browse files
committed
Add wheel installation to README, etc
1 parent 322f930 commit 3d9d981

File tree

1 file changed

+44
-23
lines changed

1 file changed

+44
-23
lines changed

README.md

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ with Apache Kafka at its core. It's high priority for us that client features ke
2424
pace with core Apache Kafka and components of the [Confluent Platform](https://www.confluent.io/product/compare/).
2525

2626
The Python bindings provides a high-level Producer and Consumer with support
27-
for the balanced consumer groups of Apache Kafka 0.9.
27+
for the balanced consumer groups of Apache Kafka >= 0.9.
2828

2929
See the [API documentation](http://docs.confluent.io/current/clients/confluent-kafka-python/index.html) for more info.
3030

@@ -40,11 +40,26 @@ Usage
4040
from confluent_kafka import Producer
4141

4242

43-
p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
43+
p = Producer({'bootstrap.servers': 'mybroker1,mybroker2'})
44+
45+
def delivery_report(err, msg):
46+
""" Called once for each message produced to indicate delivery result.
47+
Triggered by poll() """
48+
if err is not None:
49+
print('Message delivery failed: {}'.format(err))
50+
else:
51+
print('Message delivered to {} [{}]'.format(msg.topic(), msg.partition()))
4452

4553
for data in some_data_source:
46-
p.produce('mytopic', data.encode('utf-8'))
54+
# Trigger delivery report callbacks from previous produce() calls
55+
p.poll(0)
56+
57+
# Asynchronously produce a message, the optional but recommended
58+
# delivery report callback will be triggered from poll()
59+
# when the message has been successfully delivered or failed permanently.
60+
p.produce('mytopic', data.encode('utf-8'), callback=delivery_report)
4761

62+
# Wait for any outstanding messages to be delivered
4863
p.flush()
4964
```
5065

@@ -66,8 +81,10 @@ c = Consumer({
6681
c.subscribe(['mytopic'])
6782

6883
while True:
69-
msg = c.poll()
84+
msg = c.poll(1.0)
7085

86+
if msg is None:
87+
continue
7188
if msg.error():
7289
if msg.error().code() == KafkaError._PARTITION_EOF:
7390
continue
@@ -171,6 +188,24 @@ See the [examples](examples) directory for more examples, including [how to conf
171188
[Confluent Cloud](https://www.confluent.io/confluent-cloud/).
172189

173190

191+
Install
192+
=======
193+
194+
**Install self-contained binary wheels for OSX and Linux from PyPi:**
195+
196+
$ pip install confluent-kafka
197+
198+
**Install AvroProducer and AvroConsumer:**
199+
200+
$ pip install confluent-kafka[avro]
201+
202+
**Install from source from PyPi** *(requires librdkafka + dependencies to be installed separately)*:
203+
204+
$ pip install --no-binary :all: confluent-kafka
205+
206+
For source install, see *Prerequisites* below.
207+
208+
174209
Broker Compatibility
175210
====================
176211
The Python client (as well as the underlying C library librdkafka) supports
@@ -200,7 +235,7 @@ Prerequisites
200235
* Python >= 2.7 or Python 3.x
201236
* [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.5 (latest release is embedded in wheels)
202237

203-
librdkafka is embedded in the manylinux wheels, for other platforms or
238+
librdkafka is embedded in the macosx manylinux wheels, for other platforms or
204239
when a specific version of librdkafka is desired, following these guidelines:
205240

206241
* For **Debian/Ubuntu**** based systems, add this APT repo and then do `sudo apt-get install librdkafka-dev python-dev`:
@@ -211,24 +246,10 @@ http://docs.confluent.io/current/installation.html#rpm-packages-via-yum
211246

212247
* On **OSX**, use **homebrew** and do `brew install librdkafka`
213248

214-
215-
Install
216-
=======
217-
218-
**Install from PyPi:**
219-
220-
$ pip install confluent-kafka
221-
222-
# for AvroProducer or AvroConsumer
223-
$ pip install confluent-kafka[avro]
224-
225-
226-
**Install from source / tarball:**
227-
228-
$ pip install .
229-
230-
# for AvroProducer or AvroConsumer
231-
$ pip install .[avro]
249+
**NOTE:** The pre-built Linux wheels do NOT contain SASL Kerberos support.
250+
If you need SASL Kerberos support you must install librdkafka and
251+
its dependencies using the above repositories and then build
252+
confluent-kafka from source.
232253

233254

234255
Build

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