You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Response messages in addition to the kafka_correlationId Header should have the same keys as their corresponding request messages when constructing the Request-Reply semantics on top of ReplyingKafkaTemplate and SendTo.
Current Behavior
The response messages have no keys (null)
Context
When one sends a message/request it's only natural to expect that the response message have same key as the original message (request). Such an explicit formalization can allow engineers to reason about the workload. Also it might come in handy when there are different consumers listening the reply topic.
Here is a brief example of what this issue is about
Sender:
voidsender(ReplyingKafkaTemplate<String, String, String> template) {
finalProducerRecord<String, String> record = newProducerRecord<>(
"mytopic",
"key",
"value"
);
varreplay = template.sendAndReceive(record, responseTimeout);
// THIS ASSERTION FAILSassert"key".equals(replay.get().key()) : "The response should have the same key";
}
I am taking a look at this issue. It's straightforward with a single return record, as in the example above. I wonder what the semantics are if the return type is a batch or a collection. In the case of a collection, the framework may not detect what keys to provide, and it is up to the application to provide the keys by wrapping them in a Message. What do you think?
sobychacko
added a commit
to sobychacko/spring-kafka
that referenced
this issue
Aug 2, 2024
Expected Behavior
Response messages in addition to the
kafka_correlationId
Header should have the same keys as their corresponding request messages when constructing the Request-Reply semantics on top ofReplyingKafkaTemplate
andSendTo
.Current Behavior
The response messages have no keys (
null
)Context
When one sends a message/request it's only natural to expect that the response message have same key as the original message (request). Such an explicit formalization can allow engineers to reason about the workload. Also it might come in handy when there are different consumers listening the reply topic.
Here is a brief example of what this issue is about
Sender:
Listener:
If you run this snippet, you will get the assertion error, because the key of the replying message is null.
The text was updated successfully, but these errors were encountered: