Producers create messages and publish (send) them to a broker server (RabbitMQ).What’s a message? A message has two parts: a payload and a label. The payload is the data you want to transmit. It can be anything from a JSON array to an MPEG-4 of yourfavorite iguana Ziggy. RabbitMQ doesn’t care. The label is more interesting. It describes the payload, and is how RabbitMQ will determine who should get a copy of your message. Unlike, for example, TCP, where you specify a specific sender and a specificreceiver, AMQP only describes the message with a label (an exchange name andoptionally a topic tag) and leaves it to Rabbit to send it to interested receivers based on that label. The communication is fire-and-forget and one-directional. We’ll getmore details about how RabbitMQ interprets the label later when we talk about exchanges and bindings. For now, all you need to know is that producers create messagesand label them for routing (see figure 2.1).

Consumers are just as simple. They attach to a broker server and subscribe to a
queue. Think of a queue as a named mailbox. Whenever a message arrives in a particular
mailbox, RabbitMQ sends it to one of the subscribed/listening consumers. By the

time a consumer receives a message, it now only has one part: a payload. The labels
attached to the message don’t get passed along with the payload when the message is
routed. RabbitMQ doesn’t even tell you who the producer/sender was.

, if you need
to know specifically who produced an AMQP message, it’s up to the producer to
include that information as a part of the message payload.

First, you need to understand queues. Conceptually, there are
three parts to any successful routing of an AMQP message: exchanges, queues, and
bindings. The exchanges are where producers publish their messages, queues are
where the messages end up and are received by consumers, and bindings are how the
messages get routed from the exchange to particular queues.

《RabbitMQ in action》的更多相关文章

  1. 【推荐】《Netty in action》书籍

    最近准备开始阅读一下<Netty in action>并且准备构架设计一个分布式系统.用于新项目. 貌似压力很大啊.压力就是东西.希望自己能够调节好. Netty in action是Ne ...

  2. 《Go in action》读后记录:Go的并发与并行

    本文的主要内容是: 了解goroutine,使用它来运行程序 了解Go是如何检测并修正竞争状态的(解决资源互斥访问的方式) 了解并使用通道chan来同步goroutine 一.使用goroutine来 ...

  3. 《ActiveMQ in Action》【PDF】下载

    内容介绍TheApache ActiveMQ message broker is an open source implementation ofthe Java Message Service sp ...

  4. 《maven in action》部分知识点总结

    maven in action 的部分知识点总结 今天又将<maven in action>这本书看了一遍,总结了一下,大概需要的知识点 (一)解耦   使用maven,在没有任何实际的J ...

  5. 《Netty in action》 读书笔记

    声明:这篇文章是记录读书过程中的知识点,并加以归纳总结,成文.文中图片.代码出自<Netty in action>. 1. 为什么用Netty? 每个框架的流行,都一定有它出众的地方.Ne ...

  6. Netty | 第1章 Java NIO 网络编程《Netty In Action》

    目录 前言 1. Java 网络编程 1.1 Javs NIO 基本介绍 1.2 缓冲区 Buffer 1.2 通道 Channel 1.3 选择器 Selector 1.4 NIO 非阻塞网络编程原 ...

  7. 《Netty in action》目录修复版本分享

    最近阅读了Netty in action一书.深感外国友人的书籍编写能力强大.作者由简入深.精简描述了Netty的相关知识,如何使用等等. 本来想翻译一下的.尝试着翻译了一点之后.发现非常痛苦啊.ps ...

  8. 《Spring In Action》阅读笔记之装配bean

    Spring主要装配机制 1.在XML中进行显式配置 2.在Java中进行显式配置 3.隐式的的bean发现机制和自动装配 自动化装配bean Spring从两个角度来实现自动化装配 1.组件扫描:S ...

  9. 重读《Struts In Action》

    Figure   1.1. The Java Servlet API exposes the HTTP client/server protocol to the Java   platform. S ...

随机推荐

  1. java web中cookie的永久创建与撤销

    一.首先是创建cookie 当在数据库中查找知道所输入的用户名和密码正确之后,就开始创建: String cb=request.getParameter("cb");//cb就是登 ...

  2. 终于解决了我的DISCUZ 无法连接到您的服务器,可能您的服务器处于防火墙后端 论坛云平台的问题~

    事由:由于前几天折腾备份,将论坛源文件误删了大部分,于是我重新下载了源码,传到了空间. 然后问题来了,我关闭纵横搜索提示“无法连接到您的服务器,可能您的服务器处于防火墙后端”,设置纵横搜索页一直显示“ ...

  3. Linux ed

    ed 编辑器是 Linux 操作系统下最简单的文本编辑器.它是以行为单位对文件进行编辑的编辑器,而不像 MS-DOS 系统下的 edit 那样是以整个屏幕框架为单位对文件进行编辑的.因此,如果你已经习 ...

  4. Jquery 获取各种高度、宽度【整理】

    alert($(window).height()); //浏览器当前窗口可视区域高度 alert($(document).height()); //浏览器当前窗口文档的高度 alert($(docum ...

  5. 获取json对象长度的问题

    平时,我们获取一些字符串或数组的长度的时候会使用length,例如: var str ="asdasd" console.log(str.length) //输出6 var arr ...

  6. 修改ECSHOP注册只需要email,并且使用email作为账号

    现在很多主流的电商网站都直接用email作为会员账号,好处是省得用户既要想一个用户名,又要填邮箱,邮箱对于电商网站的重要性不用多提,因此用email作为会员的唯一标识是很合理的做法,本文给出针对ECS ...

  7. 大批量DML操作应该注意什么?

    问:大批量DML操作应该注意什么? 答:大批量DML操作可能会撑爆undo表空间,导致数据库挂起.因此我们应该设置一个合适的undo表空间,或对DML操作的分批提交.

  8. PHP - PDO 之 mysql 参数绑定

    <?php /* pdo 学习 */ $dsn = 'mysql:host=localhost;dbname=cswl';//构建连接dsn $db = new pdo($dsn,'root', ...

  9. poi导出到excel步骤分析

    在没用过poi之前感觉poi是很高大上的样子, 项目中用了发现poi的代码重复性很高类似于jdbc的模板代码, 项目中如果大量使用最好封装起来; 总结一下归结为6步 1 打开或新创建一个工作薄(使用H ...

  10. ashx与验证码

    using System; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; us ...