Catalogue
参考资料:
What is Message Queue
- A message queue is a queue of messages sent between applications. 中间人
- Message queues provide an asynchronous communications protocol, meaning that the sender and receiver of the message do not need to interact with the message queue at the same time.
- An application framework for sending and receiving messages
- A way to communicate between applications / systems
- A way to decouple components
- A way to offload work (handle to another worker)
Application
- Allow web servers to respond to requests quickly instead of being forced to perform resource-heavy procedures.
- Able to distribute a message to multiple recipients for consumption or for balancing loads between workers.
- 消息队列中间件是分布式系统中重要的组件,主要解决应用耦合,异步消息,流量削锋等问题。实现高性能,高可用,可伸缩和最终一致性架构。是大型分布式系统不可缺少的中间件。
- 目前在生产环境,使用较多的消息队列有ActiveMQ,RabbitMQ,ZeroMQ,Kafka,MetaMQ,RocketMQ等。
Message Queue in Real Life
对实时性要求不高的任务!
- Image Resizing
- Video Processing
- Sending out Emails (Ad Campaigns)
- Log Analysis
- …
AMPQ协议
Message Queue Protocol
- AMQP - Advanced Message Queue Protocol (RabbitMQ)
- STOMP - Streaming Text Oriented Messaging Protocol (ActiveMQ)
- XMPP - Extensible Messaging and Presence Protocol
Network wire-level protocol
- Defines how clients and brokers talk
- Data serialization, heartbeat
AMQP Model
- Defines routing and storing of messages
- Defines rules how these are wired together
- Exported API
RabbitMQ
- RabbitMQ是流行的开源消息队列系统,用erlang语言开发。RabbitMQ是AMQP(高级消息队列协议)的标准实现。Implements AMQP
- Easy to use, 支持多种客户端,如:Python、Ruby、.NET、Java、JMS、C、PHP、ActionScript、XMPP、STOMP等,支持AJAX,持久化。用于在分布式系统中存储转发消息,在易用性、扩展性、高可用性等方面表现不俗。
- Open source and commercially supported
RabiitMQ Solution
- Could-based Solution
- Local
1
brew install rabbitmq # would take long