Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make use of incoming Message's replyTopic header if needed #2904

Conversation

NathanQingyangXu
Copy link
Contributor

@NathanQingyangXu NathanQingyangXu commented Nov 17, 2023

as per reference doc: https://docs.spring.io/spring-kafka/docs/current/reference/html/#reply-message:

Starting with version 2.5, the framework will detect if these headers are missing and populate them with the topic - either the topic determined from the @sendto value or the incoming KafkaHeaders.REPLY_TOPIC header (if present)

Seems we overlooked the incoming KafkaHeaders.REPLY_TOPIC logic.

@NathanQingyangXu NathanQingyangXu force-pushed the improve-MessagingMessageListenerAdapter#checkHeaders branch 4 times, most recently from 714c6ed to be3b805 Compare November 17, 2023 12:16
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

@NathanQingyangXu ,

thank you very much for so thoughtful contributions!

Would you mind double checking if PR build failure is related somehow to your changes: https://github.com/spring-projects/spring-kafka/actions/runs/6903843623/job/18783345784?pr=2904 ?

@NathanQingyangXu NathanQingyangXu force-pushed the improve-MessagingMessageListenerAdapter#checkHeaders branch from be3b805 to f7da425 Compare November 17, 2023 18:07
@artembilan
Copy link
Member

Can you, please, stop squashing your commits?
It is really much easier to review if there is a history of commits in the PR.
And sometime we just review the latest commit which might not include changes for other files.
When we merge PR, we squash to preserve only one commit in the main for the issue we are resolving.

Thanks for understanding!

@NathanQingyangXu NathanQingyangXu changed the title improve MessagingMessageListenerAdapter#checkHeaders() make use of incoming Message's replyTopic header if needed Nov 17, 2023
@NathanQingyangXu
Copy link
Contributor Author

Can you, please, stop squashing your commits? It is really much easier to review if there is a history of commits in the PR. And sometime we just review the latest commit which might not include changes for other files. When we merge PR, we squash to preserve only one commit in the main for the issue we are resolving.

Thanks for understanding!

a little bit late to read this comment. yeah, for sure. I totally understand. Will keep that in mind from now on. thanks.
btw, I am not very confident about my changes in this PR (seems a big overlooking if valid). I am a developer whose job requires good Spring Kafka experience and I think contributing directly is the best way to learn. Thanks for your patience and good product.

@NathanQingyangXu
Copy link
Contributor Author

@NathanQingyangXu ,

thank you very much for so thoughtful contributions!

Would you mind double checking if PR build failure is related somehow to your changes: https://github.com/spring-projects/spring-kafka/actions/runs/6903843623/job/18783345784?pr=2904 ?

as usual, unit testing cases protected. Fixed the bug and now they would not complain.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

Looks like this fix introduces some new functionality.
Any chances to have ti covered with unit test, please?

@NathanQingyangXu
Copy link
Contributor Author

NathanQingyangXu commented Nov 17, 2023 via email

@NathanQingyangXu
Copy link
Contributor Author

During unit testing case development, I found this PR is invalid. For the following code snippet:

/**
* Return the default expression when no SendTo value is present.
* @return the expression.
* @since 2.2.15
*/
public static String getDefaultReplyTopicExpression() {
return PARSER_CONTEXT.getExpressionPrefix() + "source.headers['"
		+ KafkaHeaders.REPLY_TOPIC + "']" + PARSER_CONTEXT.getExpressionSuffix();
}

so if no reply topic is specified, the above default expression will ensure we got the value from KafkaHeaders.REPLY_TOPIC header.
There are other minior issues valid in this PR, but given the gist of it is invalid, I close this PR for now.

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.

2 participants