apache-kafka - Configuring ReplyingKafkaTemplate for getting the responses from multiple topics
问题描述
I have a requirement where I must use the synchronous request-reply pattern with Kafka, hence I am using ReplyingKafkaTemplate for the same.
As a part of implementation, there is a producer which is pushing a request message on one topic(input-message-topic1) but in return I am expecting responses from two topics(output-message-topic1 and output-message-topic2) which I have to aggregate and process further.
Question : Is it possible to implement the above scenario with ReplyingKafkaTemplate / AggregatingReplyingKafkaTemplate or any other implementation which uses synchronous request-reply pattern with Kafka ?
解决方案
Yes, the AggregatingReplyingKafkaTemplate
will do this; just configure its listener container to consume from both topics; the replies must contain the correlation id header (used to aggregate).
推荐阅读
- r - 下采样 R 时训练/测试样本不是随机的
- python - 为什么我的代码在 .py 文件中运行时可以工作,但在 Python 解释器中返回 SyntaxError?
- cql - cqlsh:错误:没有这样的选项:--request-timeout
- python - SyntaxError (Python Jupyter Notebook)
- regex - 在 VS Code 中查找缺少两个右括号中的一个的字段
- javascript - 从 JSON 数组中删除元素
- c++ - ">> 未找到采用 'std::ifstream' 类型的左手运算符的运算符(或没有可接受的转换)"
- python - Pygame 碰撞检测`colliderect()`
- jquery - Bootstrap 4.3.1 模态对话框是否具有类似于 jQuery UI 数据存储属性的数据属性?
- python - 使用 Python 中的 beautifulsoup 和 selenium 在 Google Scholar 中进行 Web Scraping