生如夏花

导航

什么是 Message Queue

Message Queue 是一种非同步的从一个服务到另一个服务的交流形式, 被用于无服务器架构和微服务架构中。

Messages 被储存在一个队列中直到被处理了或被删除。

每个Messages只会被唯一的Consumer处理一次.

Message Queue can be used to decouple heavyweight processing, to buffer or batch work, and to smooth spiky workloads.

 

Message Queue Basics

In modren cloud architecture, applications are decoupled into smaller, independent building blocks that are easier to develop, deploy and maintain. 

Message Queue provides communication and coordinate for these distributed applications; therefore, Message Queue can signicantly simplify coding of decoupled applications, while improving performance, reliability and scalability.

Message Queue allow different parts of a system to comunication and process operations asynchronously. 

A Message Queue provides a lightweight buffer to temporarily stores messages and endpoints, so that components can connect to the queue in order to send and receive messages. The messages are usually small, and can be things like requests, replies, error messages, or just plain information. 

To send a message, a components called a producer adds a message to the queue. The message is stored on the queue until another components called consumer retrieves the message and does something with it.

Many producers and consumers can use the queue, but each message can only be processed once, by a single consumer. For this reason, this messaging pattern is often called one-to-one, or point-to-point, comunications. 

When a message needs to be processed more than one consumer, Message queue can be conbined with Publish / Subscribe messaging in a fanout design pattern.

 

posted on 2019-01-13 02:48  生如夏花.ca  阅读(418)  评论(0编辑  收藏  举报