-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
crash when delivery mode not specified in message #3
Comments
What you want to see by default when "None" was passed? |
I think It's must be explicit and required. |
OK, in that case I think I'd prefer that it log and discard malformed messages rather than raise an exception. Do you have a consistent approach to handling messages that are malformed in other ways? |
@mosquito I've got the same issue when using django channels as the message sender. And I see in the official pika spec that delivery_mode can be None (pika.spec.BasicProperties https://github.com/pika/pika/blob/master/pika/spec.py#L2074). |
What default value I should be set? |
I see you already set it to non-persistent which for me is fine |
Ok. 😊 |
Great! Thank you! I can make PR if it speed up the things =) |
@ollamh, feel free to create PR. |
Fixed in 0.9.4 |
I started testing compatibility between this module and the asynqp Python AMQP module. aio-pika crashes with a TypeError when reading a message that doesn't specify delivery mode, in message.py line 39:
self.delivery_mode = DeliveryMode(int(delivery_mode)).value
It fails to convert NoneType to an int.
I am not positive whether the delivery mode field of a message is required, but it would be nice to have either cleaner reporting of the problem or defaulting of the value in aio-pika, to check whether it is None before trying to convert it to an int.
The text was updated successfully, but these errors were encountered: