http://www.rabbitmq.com/tutorials/tutorial-four-python.html
We will use a direct exchange instead. The routing algorithm behind a
direct exchange is simple – a message goes to the queues whose binding
key exactly matches the routing key of the message.In this setup,we can see the direct exchange X with two queues bound
to it. The first queue is bound with binding key orange,and the
second has two bindings,one with binding key black and the other one
with green.In such a setup a message published to the exchange with a routing key
orange will be routed to queue Q1. Messages with a routing key of
black or green will go to Q2. All other messages will be discarded.
寻找对服务总线架构有深刻理解的人,以推荐实现此类队列的最佳向量.
让我们将图像与您的示例进行比较:
>直接交换X将是图像中的DataCollection主题.
> Q1将是Dashboard订阅(过滤器设置为Redmond)
> Q2将是库存订阅(没有过滤器,意味着它将接收所有消息).
它实际上非常简单.您的客户端向主题发送消息(类似于队列)并可以向此消息添加一些元数据(这可以用作绑定密钥).现在您不会从主题本身读取消息,主题会将消息转发给所有订阅.要实现消息路由,您只需使用类似于sql的语法在一个或多个订阅上设置过滤器.
原文地址:https://www.jb51.cc/windows/365248.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。