Skip to content

GH-4468: Fix no-op ack detection for non-null Acknowledgment#4470

Merged
artembilan merged 1 commit into
spring-projects:mainfrom
abhimoondra:GH-4468
Jun 8, 2026
Merged

GH-4468: Fix no-op ack detection for non-null Acknowledgment#4470
artembilan merged 1 commit into
spring-projects:mainfrom
abhimoondra:GH-4468

Conversation

@abhimoondra

Copy link
Copy Markdown
Contributor

Fixes #4468.

The built-in DLT logging handler LoggingDltListenerHandlerMethod.logMessage(Object, @NonNull Acknowledgment) stopped working under a non-manual ack mode on 4.0. Its @NonNull is now the JSpecify @NonNull (a TYPE_USE annotation), which MethodParameter.getParameterAnnotation() doesn't return, so noOpAck stayed false and the DLT consumer failed with No Acknowledgment available ... MANUAL AckMode and re-published the record to the same DLT in a loop.

Switched the check in MessagingMessageListenerAdapter.determineInferredType to Nullness.forMethodParameter() (per the suggestion on the issue), which understands TYPE_USE and @NullMarked nullness.

Also added a test covering the non-null Acknowledgment parameter case, which wasn't covered before.

@artembilan artembilan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Please, add your name to the @author list of all the affected classes.

Thank you!

…dgment

The built-in DLT logging handler declares its Acknowledgment parameter
with the JSpecify @nonnull, which is a TYPE_USE annotation that
MethodParameter.getParameterAnnotation() does not see. So noOpAck stayed
false and, under a non-manual ack mode, DLT consumption failed with
"No Acknowledgment available ... MANUAL AckMode".

Use Nullness.forMethodParameter() instead, which understands TYPE_USE and
@NullMarked nullness.

Add a test for the non-null case. Also mark the Acknowledgment parameters
in testMissingAck and testBadAckConfig as @nullable so they keep
exercising the missing-ack error path under the corrected semantics.

Signed-off-by: Abhishek Moondra <abhishek.moondra@sixt.com>
@abhimoondra

Copy link
Copy Markdown
Contributor Author

Done. Added my name to the @author list of the affected classes.

One thing — testBadAckConfig started failing with the change. Its listener's Acknowledgment param is unannotated in a @NullMarked package, so Nullness now sees it as non-null and substitutes the no-op ack instead of failing. Marked that param (and the one in testMissingAck) @Nullable so they still hit the missing-ack path. Lmk if you'd rather handle it differently.

@abhimoondra abhimoondra requested a review from artembilan June 8, 2026 06:53
@artembilan artembilan enabled auto-merge (squash) June 8, 2026 14:40
@artembilan artembilan merged commit 8b4e205 into spring-projects:main Jun 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@RetryableTopic: built-in DLT logging handler fails with "No Acknowledgment available" on 4.0 (works on 3.3.x)

2 participants