Fast python Kafka client for asyncio. Asynckafka is written in Cython on top of Rdkafka as Kafka driver.
The documentation can be found here.
- Consumer using a balanced group
- Consumer using custom topic partitions and offset
- Producer
The library was born as a project to learn Cython and and has not been actively maintained in the last years, Therefore it should be used with caution.
How to use a consumer:
consumer = Consumer(
brokers='localhost:9092',
topics=['my_topic'],
group_id='my_group_id',
)
consumer.start()
async for message in consumer:
print(f"Received message: {message.payload}")
How to use a producer:
producer = Producer(brokers="localhost:9092")
producer.start()
await producer.produce("my_topic", b"my_message")
The test was performed in June of 2018 using a single Kafka broker without replication. The purpose of the benchmark was only to have an idea of the order of magnitude of the library's performance under these conditions.
Comparison between asynckafka and aiokafka in production and consumption:
The asynckafka benchmark can be found in the benchmark directory while the benchmark used for aiokafka can be found in its own repository.