Skip to content

Commit 4aedcb1

Browse files
committed
Iterating on the docs
1 parent f4c8c47 commit 4aedcb1

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,19 @@ Confluent's Python Client for Apache Kafka<sup>TM</sup>
44
**confluent-kafka-python** is Confluent's Python client for [Apache Kafka](http://kafka.apache.org/) and the
55
[Confluent Platform](https://www.confluent.io/product/compare/).
66

7-
Features:
7+
We provide high-level Producer, Consumer and AdminClient classes analogous to the Java client. These are backwards and forwards compatible with all Kafka brokers from version 0.8.
88

9-
- **High performance** - confluent-kafka-python is a lightweight wrapper around
10-
[librdkafka](https://github.com/edenhill/librdkafka), a finely tuned C
11-
client.
9+
Characteristics:
1210

13-
- **Reliability** - There are a lot of details to get right when writing an Apache Kafka
14-
client. We get them right in one place (librdkafka) and leverage this work
15-
across all of our clients (also [confluent-kafka-go](https://github.com/confluentinc/confluent-kafka-go)
16-
and [confluent-kafka-dotnet](https://github.com/confluentinc/confluent-kafka-dotnet)).
11+
- **Reliability** - The Python client is a lightweight wrapper around [librdkafka](https://github.com/edenhill/librdkafka) which is widely deployed in a diverse set of demanding production scenarios. It's tested using [the same set of system tests](https://github.com/confluentinc/confluent-kafka-python/tree/master/confluent_kafka/kafkatest) as the Java client [and more](https://github.com/confluentinc/confluent-kafka-python/tree/master/tests). It's supported by [Confluent](https://confluent.io).
1712

18-
- **Supported** - Commercial support is offered by
19-
[Confluent](https://confluent.io/).
13+
- **Performance** - Performance is a key design consideration. Maximum throughput is comparable to the Java client for larger message sizes (where the overhead of the Python interpreter has less impact).
2014

2115
- **Future proof** - Confluent, founded by the
2216
creators of Kafka, is building a [streaming platform](https://www.confluent.io/product/compare/)
2317
with Apache Kafka at its core. It's high priority for us that client features keep
2418
pace with core Apache Kafka and components of the [Confluent Platform](https://www.confluent.io/product/compare/).
2519

26-
The Python bindings provides a high-level Producer and Consumer with support
27-
for the balanced consumer groups of Apache Kafka &gt;= 0.9.
2820

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

@@ -34,6 +26,9 @@ See the [API documentation](http://docs.confluent.io/current/clients/confluent-k
3426
Usage
3527
=====
3628

29+
Below are some examples of typical usage. For more examples, including [how to configure](examples/confluent_cloud.py) the python client for use with
30+
[Confluent Cloud](https://www.confluent.io/confluent-cloud/), see the [examples](examples) directory.
31+
3732
**Producer:**
3833

3934
```python
@@ -177,8 +172,31 @@ while True:
177172
c.close()
178173
```
179174

180-
See the [examples](examples) directory for more examples, including [how to configure](examples/confluent_cloud.py) the python client for use with
181-
[Confluent Cloud](https://www.confluent.io/confluent-cloud/).
175+
**AdminClient**
176+
177+
Create topics:
178+
179+
```python
180+
new_topics = [NewTopic(topic, num_partitions=3, replication_factor=1) for topic in topics]
181+
# Call create_topics to asynchronously create topics, a dict
182+
# of <topic,future> is returned.
183+
fs = a.create_topics(new_topics)
184+
185+
# Wait for each operation to finish.
186+
for topic, f in fs.items():
187+
try:
188+
f.result() # The result itself is None
189+
print("Topic {} created".format(topic))
190+
except Exception as e:
191+
print("Failed to create topic {}: {}".format(topic, e))
192+
```
193+
194+
195+
196+
Thread Safety
197+
-------------
198+
199+
The `Producer`, `Consumer` and `AdminClient` are all thread safe.
182200

183201

184202
Install

0 commit comments

Comments
 (0)