Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.35k stars 2k forks source link

[BUG] DLQ reason and description not work in spring-cloud-azure-stream-binder-servicebus #40951

Closed Sheldoras closed 4 months ago

Sheldoras commented 4 months ago

Is your feature request related to a problem? Please describe. When using spring-cloud-azure-stream-binder-servicebus I'd like to have a possibility to set a DLQ reason and description when requeuing messages into the DLQ (as it is possible when using the Azure Service Bus SDK).

Looking at the source code it seems that initially the value for DLQ reason and description is a static value / derived from the exception cause (if available).

However when following that logic along one call further, the information about DLQ reason and description is dropped/unused and thus gets lost for all subsequent logic, resulting in no DLQ reason or description ever being set when an exception causes a message to be requeued in the DLQ.

Describe the solution you'd like I would like to see the cause of any exception causing a message to be requeued in the DLQ to be reflected in the deadLetterErrorDescription - as it appears to be intended in the code in the first place.

The messageContext on which deadLetter is being called here also offers an overload which accepts DeadLetterOptions. So in general it seems possible to pass these values along, it just isn't being done right now.

Describe alternatives you've considered Alternatively I would be interested in the reasoning as to why deadLetterErrorDescription and deadLetterReason are simply 'dropped' and not processed any further in the current implementation.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

joshfree commented 4 months ago

@saragluna @yiliuTo PTAL