This example uses the kafka-python library to interact with Kafka both as a producer of messages and a consumer.
pip install kafka-python
Note: You can find the connection details in the "Overview" tab in the Aiven Console.
- Use the Aiven Client to create a topic in your Kafka cluster:
avn service topic-create <kafka-service-name> python_example_topic --partitions 3 --replication 3
- Produce some messages:
./main.py --service-uri <host>:<port> \ --ca-path <ca.pem path> \ --key-path <service.key path> \ --cert-path <service.cert path> \ --producer
- Consume some messages:
./main.py --service-uri <host>:<port> \ --ca-path <ca.pem path> \ --key-path <service.key path> \ --cert-path <service.cert path> \ --consumer