-
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
Publish hangs with 'publisher confirms' enabled #149
Comments
There's an asyncio task running the dispatcher that reads messages from the server and calls handler methods; Line 641 in cbb1379
Confirm select changes the messaging with the server so for the basic.public messages you send (by calling If I'm reading the code correctly, having another channel should not help if confirm_select() is used, because the connection's main dispatcher just delegates to the channels, and doesn't process the next message from the server until the channel method returns. The publisher confirms are channel-specific, so it might be that it works because there's not actually any confirms used on the channel. One workaround is to call loop.create_task for publish_and_ack(), which allows the library's dispatcher to process the next messages. But then you have to clean up those tasks once they finish somewhere else to avoid warnings. |
But it does help. Tried to set up yet another (third) channel, it works with it too. To sum up:
Looks like it does not works only in that channel which was used to call
Yes, I mentioned this at second point in the initial post. I don't like it and at the same time another workaround (enabling confirms in a separate channel) work pretty well. Are there any pros to use your workaround, namely? |
My service reads messages from one queue and outputs processed messages to another exchange.
I want to ack incoming message only after successful publishing of outgoing message. It worked well untill I met some issues with lost messages and I decided to enable 'publisher confirms' feature. After this my program started to hang forever on
publish()
. Here is the simple code to illustrate problem.I tried to play with it and found the following:
await self.publisher.confirm_select()
.publish_and_ack()
in task (e.g.asyncio.ensure_future()
), but I dislike releasing the task to 'free float'.consumer
orchannel
(which are the same) inon_message()
instead ofpublisher
.consumer
or onlypublisher
).confirm_select()
from separate channel (e.g.publisher
) and use another channel everywhere.It seems really weird. Am I doing everything correctly?
What is the best practice of using channels with this lib?
The text was updated successfully, but these errors were encountered: