Skip to content

Conversation

sobychacko
Copy link
Contributor

Fixes: #3395

When using ReplyingKafkaTemplate, include the original key from the request record if such a key exists.

Fixes: spring-projects#3395

When using `ReplyingKafkaTemplate,` include the original key from the request record if such a key exists.
----

[[record-key-in-reply]]
== Preserving Request Record Key in Reply
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a dedicated section for this single short paragraph?
Why it cannot be included in the end if the previous one?
At least it looks like both of them talks about similar context.
Where that Message indeed covers what you try to say about multi-value reply.


protected void asyncSuccess(@Nullable Object result, String replyTopic, Message<?> source,
boolean returnTypeMessage) {

Copy link
Member

Choose a reason for hiding this comment

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

This is really a good style to make code more readable.
There is might no reason to do that for single-like method header, but if it is multi-line, then better to separate body for easy review.
Please, revert this change and fix your IDE to preserver such a blank line on refactoring.


@Nullable
private Object getReplyKeyFromRequest(Message<?> source) {
return source.getHeaders().get(KafkaHeaders.RECEIVED_KEY);
Copy link
Member

Choose a reason for hiding this comment

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

I don't see a reason in this one-line method.
More over it feel like static.
Way, either way: I'd prefer to not have it making me thinking "where else this method can be used" 😄


protected void asyncFailure(Object request, @Nullable Acknowledgment acknowledgment, Consumer<?, ?> consumer,
Throwable t, Message<?> source) {

Copy link
Member

Choose a reason for hiding this comment

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

Why haven't you reverted this?


protected void handleException(Object records, @Nullable Acknowledgment acknowledgment, Consumer<?, ?> consumer,
Message<?> message, ListenerExecutionFailedException e) {

Copy link
Member

Choose a reason for hiding this comment

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

DITTO, please.

}
----

=== Original Record Key in Reply
Copy link
Member

Choose a reason for hiding this comment

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

Why do you still think that this short paragraph deserves its own title?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see a problem with a separate section for this, but I am neutral either way.

@artembilan artembilan merged commit b003dff into spring-projects:main Aug 5, 2024
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.

Use the original key in reply messages when using ReplyingKafkaTemplate and SendTo
2 participants