confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

Add Consumer.io_event_enable

Open stephan-hof opened this issue 3 years ago • 13 comments

Hello,

this pull requests adds a method called io_event_enable to the Consumer. It simply wraps rd_kafka_queue_io_event_enable from librdkafka.

My goal is to make integration with async frameworks easier. Using it allows the async framework to be immediately notified when a new message arrived in the queue. Avoiding,

  • the use of threads
  • busy loops around Consumer.poll(timeout=0)

I'm not entirely sure about the linux_asyncio_consumer.py. Should it be part of the confluent-kafka repository or not? My thinking was to show how io_event_enable could be used.

Update: Now that I checked the issue tracker somebody already came up with the idea: https://github.com/confluentinc/confluent-kafka-python/issues/185#issuecomment-382232005 so consider this pull-request as an implementation of it.

stephan-hof avatar Oct 16 '22 16:10 stephan-hof

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Oct 16 '22 16:10 CLAassistant

I'm not entirely sure about the linux_asyncio_consumer.py.

Having this as an example is good :+1:

edenhill avatar Dec 16 '22 13:12 edenhill

Many thanks for looking at this pull request. I made a commit trying to address the changes requested by the review. I'm wondering now what is the next step on my side. Should I mark the conversations as 'resolved'? Or should I simply wait for the next review.

stephan-hof avatar Dec 19 '22 07:12 stephan-hof

We're currently in release code freeze, but will revisit this PR in January when the upcoming release is out. Thank you

edenhill avatar Dec 19 '22 10:12 edenhill

Any update on this PR? I'd like to use Confluent Kafka's asynchronous methods in https://github.com/faust-streaming/faust

wbarnha avatar Apr 17 '23 17:04 wbarnha

Thanks for the ping. In the hope to speed-up things I rebased the branch on latest master.

stephan-hof avatar Apr 17 '23 18:04 stephan-hof

Bumping for posterity. Is the code freeze over @edenhill?

We would really like this functionality to be implemented to use in Faust and many other asynchronous Kafka applications!

wbarnha avatar Jun 20 '23 14:06 wbarnha

It would be amazing to have :) @edenhill

harubi avatar Sep 27 '23 14:09 harubi

It appears to me that @edenhill is not very active in the last months (hope you are well).

@pranavrth I see that you keep this project alive. So is this pull request something you cold have a look at please? If you like I can make a push to solve the conflicts on CHANGELOG.md

stephan-hof avatar Sep 28 '23 06:09 stephan-hof

Is there any other maintainer who can take a look at this 🙏🏻 ? This is a huge win for async kafka

woile avatar Jan 15 '24 15:01 woile