-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Support for gevent, process and threaded drivers #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Actually, I need this sooner rather than later so I'll just do it. |
What is the state of this issue? Haven't found any notion of "drivers" or "driver_types" in the current HEAD. |
There is no work on this afaik. |
There are no plans to use pluggable driver support. The current client code now has a very simple async io loop. I expect that if we were to implement a full async io stack, we would probably use asyncio. |
@mumrah I took the branch based on #35 and #36 - and added support for something called drivers.
Basically, if you look at the code base, we use Queue(), Event(), sleep(), socket and multiprocessing.Process() to run the show - workers, multiple-consumers and co-ordination.
Now, Queue, Event, Pool, sleep, socket etc. are provided by multiprocessing, threading and gevent. So, the code can be used as-is (almost) for running it as different process, threads or gevent co-routines.
When SimpleConsumer or MultiConsumer is initialized, we can specify driver = thread / process / gevent and
The changes are very negligible. The only complexity is in managing the duplicate connections. When a consumer is initialized, an appropriate driver (KafkaDriver) instance is created, which contains the modules that must be used.
Most involved work was in test cases :-)
You can see the diffs here (on top of #35 and #36).
mahendra/kafka-python@mpcommit...gevent
Will send a pull request after they are merged. Later will provide driver support for Producer
The text was updated successfully, but these errors were encountered: