from aiokafka import AIOKafkaProducerimport asyncio
loop = asyncio.get_event_loop()
async def send_one(): producer = AIOKafkaProducer( loop=loop, bootstrap_servers='localhost:9092')
# Get cluster layout and topic/partition allocation await producer.start()
# Produce messages await producer.send_and_wait("my_topic", b"Super message")
await producer.stop()
loop.run_until_complete(send_one())from aiokafka import AIOKafkaConsumerimport asyncio
loop = asyncio.get_event_loop()
async def consume(): consumer = AIOKafkaConsumer( "my_topic", loop=loop, bootstrap_servers='localhost:9092') # Get cluster layout and topic/partition allocation await consumer.start()
async for msg in consumer: print(msg.value)
loop.run_until_complete(consume())Great!
--
You received this message because you are subscribed to the Google Groups "aio-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aio-libs+u...@googlegroups.com.
To post to this group, send email to aio-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aio-libs/eab0f30c-fb8c-4103-9905-3484312a3249%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.