Fix DLQ reason and description not transmitted in ServiceBus binder#49662
Closed
sunghyun1999 wants to merge 2 commits into
Closed
Fix DLQ reason and description not transmitted in ServiceBus binder#49662sunghyun1999 wants to merge 2 commits into
sunghyun1999 wants to merge 2 commits into
Conversation
…nder Remove the redundant no-arg `deadLetter()` call that settles the message before the parameterized `deadLetter(options)` call can set the reason and error description. Fixes Azure#41883 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Thank you for your contribution @sunghyun1999! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the Spring Cloud Azure Service Bus Stream Binder where the dead-letter reason and error description were not being transmitted, due to a redundant no-arg deadLetter() call settling the message before the parameterized deadLetter(options) call could apply the details.
Changes:
- Removed the redundant no-arg
messageContext.deadLetter()call so the message is dead-lettered only viaDeadLetterOptions. - Ensured DLQ reason and description can be applied when dead-lettering received messages.
Comments suppressed due to low confidence (1)
sdk/spring/spring-cloud-azure-stream-binder-servicebus/src/main/java/com/azure/spring/cloud/stream/binder/servicebus/implementation/ServiceBusMessageChannelBinder.java:233
- The current test coverage doesn’t guard against regressions where
messageContext.deadLetter()(no-arg) is called beforemessageContext.deadLetter(options). That exact sequencing caused the original bug (options ignored after settlement), butServiceBusMessageChannelBinderTest.testDeadLetterCalledForErroronly verifies the parameterized overload was called (and would still pass if an extra no-arg deadLetter call happened). Consider strengthening the test to assert the no-arg overload is never invoked (e.g.,verify(messageContext, never()).deadLetter();and/orverifyNoMoreInteractions(messageContext)after the options verification).
final ServiceBusReceivedMessageContext messageContext = (ServiceBusReceivedMessageContext) message
.getHeaders()
.get(ServiceBusMessageHeaders.RECEIVED_MESSAGE_CONTEXT);
if (messageContext != null) {
DeadLetterOptions options = new DeadLetterOptions();
options.setDeadLetterReason(deadLetterReason);
options.setDeadLetterErrorDescription(deadLetterErrorDescription);
messageContext.deadLetter(options);
Strengthen the existing testDeadLetterCalledForError test to assert that the no-arg deadLetter() (which settles the message without reason) is never invoked, preventing the original bug from being reintroduced. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Closing in favor of #49663 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
messageContext.deadLetter()call inServiceBusMessageChannelBinder.deadLetter()that settles the message before the parameterizeddeadLetter(options)can set the DLQ reason and error descriptionRoot Cause
Test Plan
deadLettermethod logicFixes #41883
🤖 Generated with Claude Code