1
1
The scripts in this directory provide code examples using Confluent's Python client:
2
2
3
- * [ adminapi.py] ( adminapi.py ) : collection of Kafka Admin API operations
3
+ * [ adminapi.py] ( adminapi.py ) : Collection of Kafka Admin API operations
4
4
* [ asyncio_example.py] ( asyncio_example.py ) : AsyncIO webserver with Kafka producer
5
- * [ avro-cli.py] ( avro-cli.py ) : produces Avro messages with Confluent Schema Registry and then reads them back again
6
- * [ consumer.py] ( consumer.py ) : reads messages from a Kafka topic
7
- * [ producer.py] ( producer.py ) : reads lines from stdin and sends them to Kafka
8
- * [ eos-transactions.py] ( eos-transactions.py ) : transactional producer with exactly once semantics (EOS)
5
+ * [ avro-cli.py] ( avro-cli.py ) : Produces Avro messages with Confluent Schema Registry and then reads them back again
6
+ * [ consumer.py] ( consumer.py ) : Reads messages from a Kafka topic
7
+ * [ producer.py] ( producer.py ) : Reads lines from stdin and sends them to Kafka
8
+ * [ eos-transactions.py] ( eos-transactions.py ) : Transactional producer with exactly once semantics (EOS)
9
9
* [ avro_producer.py] ( avro_producer.py ) : SerializingProducer with AvroSerializer
10
10
* [ avro_consumer.py] ( avro_consumer.py ) : DeserializingConsumer with AvroDeserializer
11
11
* [ json_producer.py] ( json_producer.py ) : SerializingProducer with JsonSerializer
@@ -20,3 +20,36 @@ Additional examples for [Confluent Cloud](https://www.confluent.io/confluent-clo
20
20
21
21
* [ confluent_cloud.py] ( confluent_cloud.py ) : produces messages to Confluent Cloud and then reads them back again
22
22
* [ confluentinc/examples] ( https://github.com/confluentinc/examples/tree/master/clients/cloud/python ) : integrates Confluent Cloud and Confluent Cloud Schema Registry
23
+
24
+ ## venv setup
25
+
26
+ It's usually a good idea to install Python dependencies in a virtual environment to avoid
27
+ conflicts between projects.
28
+
29
+ To setup a venv with the latest release version of confluent-kafka and dependencies of all examples installed:
30
+
31
+ ```
32
+ $ python3 -m venv venv_examples
33
+ $ source venv_examples/bin/activate
34
+ $ cd examples
35
+ $ pip install -r requirements.txt
36
+ ```
37
+
38
+ To setup a venv that uses the current source tree version of confluent_kafka, you
39
+ need to have a C compiler and librdkafka installed
40
+ ([ from a package] ( https://github.com/edenhill/librdkafka#installing-prebuilt-packages ) , or
41
+ [ from source] ( https://github.com/edenhill/librdkafka#build-from-source ) ). Then:
42
+
43
+ ```
44
+ $ python3 -m venv venv_examples
45
+ $ source venv_examples/bin/activate
46
+ $ python setup.py develop
47
+ $ cd examples
48
+ $ pip install -r requirements.txt
49
+ ```
50
+
51
+ When you're finished with the venv:
52
+
53
+ ```
54
+ $ deactivate
55
+ ```
0 commit comments