Rabbit 学习(1)何为RabbitMQ

何为RabbitMQ

1. MQMessageQueue (消息队列),一种应用程序用”写”与”检索”的方法把数据(消息)以队列形式传递给另一个应用程序的工具。特点:不需要专用连接。MQ”消费——生产者”模型为结构:一端不停写入消息,另一端则可以读取或者订阅消息。MQ遵循AMQP协议(高级消息队列协议)

 

 

2. MQ关键概念:

a) Broker:消息队列服务器实体。

b) Exchange:消息交换机。指定消息按什么规则,路由到哪个队列。

c) Queue:消息队列的载体。每一个消息都会被投入到一个或者多个队列中。

d) Binding:绑定,把Exchangequeue按照路由规则绑定

e) Routing key:路由关键字,Exchange据此进行消息投递。

f) Vhost:虚拟主机,一个Broker有多个vhost,用作不同用户的权限分离。

g) Producer:消息生产者,发送消息的程序

h) Consumer:消息消费者,接收消息的程序

i) Channel:消息通道,在客户端的每个连接里,可建立多个channel,每个channel代表一个会话任务。

 

 

3.  MQ使用过程:

a) 客户端连接到消息队列服务器,打开一个channel

b) 客户端声明一个exchange,并设置相关属性。

c) 客户端声明一个queue,并设置相关属性。

d) 客户端使用routingkey,在exchangequeue之间建立好绑定关系。

e) 客户端投递消息到exchange

 

exchange接收到消息后,就根据key和已经设置的binding,进行消息路由,将消息投递到一或多个队列里。

 

Exchange有三种类型:

a) Direct:完全根据key进行投递的叫做Direct交换机。例如:绑定时设置routing key”abc”,那么客户端提交的消息,只有设置了key”abc”的消息才会被投递到消息队列中。

b) Topic:对key进行模拟匹配后进行投递的叫做Topic交换机。符号”#”匹配一个或者多个词,符号”*”匹配正好一个词,例如:”abc.#”匹配”abc.def.ghi”,”abc.*”只配置”abc.def”。

c) Fanout:采用广播模式,一个消息进来时投递到与该交换机绑定的所有队列。

 

4. RabbitMQ支持消息的持久化,即数据写在磁盘上,数据比较安全。具体包括

a) Exchange持久化,在声明是指定durable=1

b) Queue持久化,在声明是指定durable=1

c) 消息持久化,在投递是指定delivery_mode=2(1为非持久化)

ExchangeQueue都是持久化的,那么它们之间的Binding也是持久化的。若二者之间有一个是持久化一个是非持久化,则不允许建立Binding

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Key Features, Learn to administer, configure, and manage RabbitMQ instancesDiscover ways to secure and troubleshoot RabbitMQ instancesThis book is fully up-to-date with all the latest changes to version 3.5, Book Description, RabbitMQ is Open Source Message Queuing software based on the Advanced Message Queue Protocol Standard written in the Erlang Language. RabbitMQ is an ideal candidate for large-scale projects ranging from e-commerce and finance to Big Data and social networking because of its ease of use and high performance. Managing RabbitMQ in such a dynamic environment can be a challenging task that requires a good understanding not only of how to work properly with the message broker but also of its best practices and pitfalls., Learning RabbitMQ starts with a concise description of messaging solutions and patterns, then moves on to concrete practical scenarios for publishing and subscribing to the broker along with basic administration. This knowledge is further expanded by exploring how to establish clustering and high availability at the level of the message broker and how to integrate RabbitMQ with a number of technologies such as Spring, and enterprise service bus solutions such as MuleESB and WSO2. We will look at advanced topics such as performance tuning, secure messaging, and the internals of RabbitMQ. Finally we will work through case-studies so that we can see RabbitMQ in action and, if something goes wrong, we'll learn to resolve it in the Troubleshooting section., What you will learn, Apply messaging patterns using the message brokerAdminister RabbitMQ using the command line, management Web console, or management REST servicesCreate a cluster of scalable, and highly-available, RabbitMQ instancesUse RabbitMQ with the Spring Framework, MuleESB, WSO2, and Oracle databasesDeploy RabbitMQ using Puppet, Vagrant, or DockerFine-tune the performance of RabbitMQMonitor RabbitMQ using Nagios, Munin, or MonitSecure, troubleshoot, and extend RabbitMQ, About the Author, Martin Toshev is a software developer and Java enthusiast with more than eight years of experience and vast expertise originating from projects in areas such as enterprise Java, social networking, source code analysis, Internet of Things, and investment banking in companies such as Cisco and Deutsche Telekom. He is a graduate of computer science from the University of Sofia. He is also a certified Java professional (SCJP6) and a certified IBM cloud computing solution advisor. His areas of interest include a wide range of Java-related technologies (Servlets, JSP, JAXB, JAXP, JMS, JMX, JAX-RS, JAX-WS, Hibernate, Spring Framework, Liferay Portal, and Eclipse RCP), cloud computing technologies, cloud-based software architectures, enterprise application integration, and relational and NoSQL databases. Martin is one of the leaders of the Bulgarian Java Users group (BGJUG), a regular speaker at Java conferences, and one of the organizers behind the jPrime conference in Bulgaria (http://jprime.io/)., Table of Contents, Introducing RabbitMQDesign Patterns with RabbitMQAdministration, Confi guration, and ManagementClusteringHigh AvailabilityIntegrationsPerformance Tuning and MonitoringTroubleshootingSecurityInternalsContributing to RabbitMQ

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值