简体   繁体   English

Spring Boot和RabbitMQ的异步请求-答复

[英]Asynchronous request-reply with Spring Boot and RabbitMQ

We want to implement the following scenario: 我们要实现以下方案:

  1. A producer service sends some input params to another service asking for the details based on these params. 生产者服务将一些输入参数发送到另一个服务,以基于这些参数询问详细信息。
  2. A producer wants to specify the queue where it will be listening for the reply. 生产者想要指定将在其中侦听答复的队列。
  3. Moreover, a producer wants to provide some metadata so that it can correlate the params it sent with a result it got. 此外,生产者希望提供一些元数据,以便可以将其发送的参数与得到的结果相关联。

Please advice how to do this properly. 请建议如何正确执行此操作。

See the AsyncRabbitTemplate . 参见AsyncRabbitTemplate

It uses the correlationId and replyTo properties to convey that information to the service that handles the request. 它使用correlationId和replyTo属性将该信息传达给处理请求的服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM