--- RabbitMQ messaging middleware Getting Started 1 --- Introduction and Installation

Message Queue Middleware is a distributed system, an important component, mainly to solve application coupled, asynchronous messaging, traffic and other issues cut front to achieve high performance, highly available, scalable and ultimately be more consistency [architecture] have to use ActiveMQ message queue , RabbitMQ, ZeroMQ, Kafka, MetaMQ , RocketMQ.
We introduce the topic priority RabbitMQ:

1, RabbitMQ Profile

       RabbitMQ is an open source implementation developed by the AMQP Erlang language.
       AMQP : Advanced the Message Queue, Advanced Message Queuing Protocol. It is an open standard application-layer protocol for message-oriented middleware design, based on this protocol client and messaging middleware message can be transmitted, is not subject to the limitations of product development language.
       RabbitMQ originated in the financial system to store and forward messages in a distributed system, in terms of ease of use, scalability, high availability, and so doing well. Specific features include:

       1. Reliability (Reliability)
       RabbitMQ use some mechanism to ensure the reliability, such as persistence, transmission confirmation, confirm the release.
       2. The flexible routing (Flexible Routing)                                                                                                                               before entering the message queue, the message is routed through the Exchange. For a typical routing function, RabbitMQ has provided some built-in Exchange to achieve. For more sophisticated routing capabilities, multiple Exchange can bind together, but also realize their Exchange through a plug-in mechanism.
       3. Cluster message (Clustering)
       a plurality of servers RabbitMQ can form a cluster, form a logical Broker.
       4. HA (Highly Available Queues)
       queue in the cluster can be mirrored on the machine, so that the queue is still available in the case of some of the nodes of the problem.
       The multiple protocols (the Multi-Protocol)
       RabbitMQ message queue supports multiple protocols, such as STOMP, MQTT like.
       6. Multi-language client (Many Clients)
       RabbitMQ supports almost all commonly used languages, such as Java, .NET, Ruby, and so on.
       7. Management Interface (Management UI)
       RabbitMQ provides an easy to use user interface, so that users can monitor and manage many aspects of the message Broker.
       8. Tracking Mechanism (Tracing)
       if the message is abnormal, RabbitMQ provides the message tracking mechanism, users can find out what happened.
       9. The plug-in mechanism (Plugin System)
       RabbitMQ provides a number of plug-ins to be extended in many ways, you can also write your own plug-ins.

2, a schematic diagram of the main concepts

  (1) Chart

  (2) the main concepts 

RabbitMQ Server: also known as broker server, which is a transport service. His role is to maintain a route from Producer to Consumer ensure data can be transmitted in accordance with the manner specified.
Producer: sender message producers, as A, B, C, data. Message producer connected RabbitMQ server then delivers messages to Exchange.
Consumer: the message consumer, 1,2,3 FIG recipient data. Message consumer subscription queue, RabbitMQ will send a message to the Queue message consumer.
Exchange: producer will send a message to the Exchange (switch), by the Exchange routes the message to a Queue or more (or discarded). Exchange does not store messages. The Exchange RabbitMQ have direct, fanout, topic, headers four types, each type corresponding to different routing rules.
Queue: (queue) is RabbitMQ internal object, for storing messages. A message consumer is to get the message through subscription queue, RabbitMQ messages are only stored in the Queue, the producer and the final production of the message delivered to the Queue, consumers can get messages from the Queue and consumption. More consumers can subscribe to the same Queue, Queue messages will then be apportioned equally to multiple customers for processing, rather than every consumer receives all messages and handle.
RoutingKey:Producers in time to send a message to the Exchange, will generally specify a routing key, to specify the routing rules the news, and this routing key needs and Exchange Type and binding key used in combination in order to ultimately take effect. At a fixed Exchange Type the binding key cases (usually these elements are fixed configured in normal use), our producers will be sending the message to the Exchange, by specifying routing key to determine where the message flow. RabbitMQ is set routing key length is limited to 255bytes.
Connection: (connection): Producer and Consumer are connected to RabbitMQ Server via TCP. Later we can see the beginning of this program is to establish a TCP connection.
Channels: (channel): It is built on the above-described TCP connection. Data flow are carried out in the Channel. That is, in general, is starting a program to establish a TCP connection, the second step is to build the Channel.
VirtualHost: the basic unit of access control, there are a number of VirtualHost Exchange and MessageQueue, and is used to specify which user.

3, RabbitMQ installation and startup 

Here at Docker container to install RabbiMQ, do not understand the Docker's shoes look at this article --- Docker entry and installation ---

(1) This step is omitted download image :()
 

docker pull rabbitmq:manageme


(2) create the container, rabbitmq need a map the following ports: 5671 5672 4,369,156,711,567,225,672

  • 15672 (if management plugin is enabled)
  • 15671 management listening port
  • 5672, 5671 (AMQP 0-9-1 without and with TLS)
  • epmd on behalf of 4369 (epmd) Erlang port mapping daemon  
  • 25672 (Erlang distribution)

     

docker run ‐di ‐‐name=tensquare_rabbitmq ‐p 5671:5617 ‐p 5672:5672 ‐p4369:4369 ‐p 15671:15671 ‐p 15672:15672 ‐p 25672:25672 rabbitmq:manageme

  (3) browser to access http: // ip: 15672 / # /

    The default user guest password guest

   Here is RabbitMQ Management Interface 

 

 

Published 41 original articles · won praise 47 · views 30000 +

Guess you like

Origin blog.csdn.net/u014526891/article/details/87534687