-
Notifications
You must be signed in to change notification settings - Fork 88
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
[WIP] First implementation of a new consumer API #118
base: master
Are you sure you want to change the base?
Conversation
- Added Consumer class to handle messages consumsion - Added consumer queues in channels to wire the Consumer with the Channel - Fixed all test - Need test of stop of consumsion, documentation and update of examples
Hello @lumasepa Thank you for this huge contribution. Using an asyncio.Queue was the first design of aioamqp, and I removed it. The first things is that when on high load, RabbitMQ will fill your entire ram of messages, how can we correctly avoid it ? |
I know the problem, you are rigth, what about using a limited size Queue (the size can be a parameter of the
What you think about it, @dzen ? |
Other option is the limited size Queue and raising an exception in case of fulling it. That allows the user to choose what to do with this situation, for example stop consuming or stop the flow of the channel. |
Hello @lumasepa, I'm sorry for the late reply. @dzen and I talked about your PR and we have a few comments:
for channel, body, envelope, properties in (yield from consumer.fetch_message()):
print(body) Better yet, maybe it's possible to for channel, body, envelope, properties in (yield from consumer):
print(body)
|
Hello, I'm going to answer your points in order
message = yield from consumer.fetch_message()
for channel, body, envelope, properties in message:
print(body) as you can see the asyncronous operation is done only once (not each time that the for iterates) so is not the same behaviour that the
|
60977df
to
cda3b3a
Compare
hello what is the status of this PR ? |
Hello there! I am working on https://github.com/aio-libs/aioamqp_consumer as separate project, please take a look on it! Maybe we can cooperate on more feature rich project together! |
First implementation of a new consumer API, as I propose in #87
I would like a review from polyconseil and some feedback, I think that this API can be a good one.