前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >AMQP-RabbitMQ/6/RPC模式/关注消息处理结果

AMQP-RabbitMQ/6/RPC模式/关注消息处理结果

作者头像
喜欢天文的pony站长
发布2020-06-29 12:14:02
5300
发布2020-06-29 12:14:02
举报
文章被收录于专栏:RabbitMQ实战RabbitMQ实战

6. RPC

But what if we need to run a function on a remote computer and wait for the result? Well, that's a different story. This pattern is commonly known as Remote Procedure Call or RPC. 大概意思是说,上面几种模式都是生产者将消息发送到Rabbitmq,然后就不管了,也不管是否有消费者进行了消费,也不管消费的结果是怎样的。上面几种场景已经可以满足大多数需求。但是有一种场景是生产者必须知道消费结果才能进行后续操作,

  • 图示
  • Our RPC will work like this:
  • For an RPC request, the Client sends a message with two properties: replyTo, which is set to a anonymous exclusive queue created just for the request, and correlationId, which is set to a unique value for every request.
  • The request is sent to an rpc_queue queue.
  • The RPC worker (aka: server) is waiting for requests on that queue. When a request appears, it does the job and sends a message with the result back to the Client, using the queue from the replyTo field.
  • The client waits for data on the reply queue. When a message appears, it checks the correlationId property. If it matches the value from the request it returns the response to the application.

源代码: 基于xml配置的SpringMvc项目https://github.com/FutaoSmile/SpringMvcStudyBaseXML

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-06-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 喜欢天文 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 6. RPC
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档