Azure / azure-uamqp-python

AMQP 1.0 client library for Python
MIT License
57 stars 48 forks source link

dead-letter reason not populated into error.info when a message is rejected #155

Closed yunhaoling closed 4 years ago

yunhaoling commented 4 years ago

In ServiceBus v0.50.2 and before, dead_letter doesn't populate the description to the service side when using message.reject() method. This is because description is not populated into error.info, only populated in error.description: https://github.com/Azure/azure-uamqp-python/blob/803810434d5696b42641abfea9074069be446c29/src/vendor/azure-uamqp-c/src/messaging.c#L181-L198

To populate the description properly, need to call error_set_info https://github.com/Azure/azure-uamqp-python/blob/803810434d5696b42641abfea9074069be446c29/src/vendor/azure-uamqp-c/src/amqp_definitions.c#L571

Besides, there're other properties missed for ServiceBus: DeadLetterReason, propertiesToModify.

.Net AmqpReceiver in ServiceBus is doing this: https://github.com/Azure/azure-sdk-for-net/blob/81d6ed42d456bbb3b02eeec8253f93fc1c519a3f/sdk/servicebus/Azure.Messaging.ServiceBus/src/Amqp/AmqpReceiver.cs#L584-L619

So one possible way to fix the issue is updating the underlying C API to making messaging_delivery_rejected accpet fields which is a type of AMQP_VALUE.

being AMQP_VALUE messaging_delivery_rejected(const char* error_condition, const char* error_description, fields erorr_info)

yunhaoling commented 4 years ago

v1.2.8 is out which fixed the problem.