Overall architecture model
Producer
Message producers, and then publish the message producer RabbitM created, the message typically contains two sections of the body (payload) and tags the message body is business logic with the data structures used to describe this message label message, such as the switch name and routing key
RabbitMQ rabbItMQ producer to a message based on the message delivered to the label corresponding consumer groups
queue
Consumers RabbitMQ internal object for storing message rabbitMQ does not support broadcast message, when a plurality of consumers subscribe to the same queue, the average will be apportioned to the corresponding
Consumer
Consumers, consumer groups and RabbitMQ connected to subscribe to the queue, a message when the consumer will consume the message body tag will be discarded
Exchange
Switch, the producer delivers messages to exchange route exchange messages to one or more queues can not return to the route, if the producer or discards exchange containing four types
fanout: all sent to the switch to route all messages bound to the exchanger queue
direct: to route messages and routing key binding key exact match queue
topic: direct match is exact if fuzzy matches topic route is the key
Routing keys:.. * Rabbitmq * can route: com.rabbitmq.client java.rabbitmq.demo
Routing keys:.. * * Client can route com.rabbitmq.client com.hiddent.client
Routing keys:. Com # can com.rabbitmq.client com.hiddent.client com.hiddent.demo
Segmentation operator * indicates a blur but a word representing a plurality of word #
For example, * .rabbitmq. * Represents [any word] .rabbitmq. [Any word] com.test.rabbitmq.com are not routed because there are two words left rabbtimq com and test
headers,
Matching rule does not depend on the route to route messages but the keyboard to match the content of the message according to transmission headers attribute that specifies a set of key-value pairs when bound to the queue and the switch, send message to obtain routing headers matching efficiency do not use a very low base
RoutingKey
Routing keys, producers message to the time switch will generally specify a routingKey used to specify message routing rules routingKey this need and BidingKey used in combination to take effect
BindingKey
By BidingKey the queue associated with the switch via the switch BindingKey routed to know which queue
understanding
Delivery man understood as producer
understood as the exchange and distribution Inn
understood as routing key configuration Inn Address
binding key to understand the destination address
Multiplexing Channel
Send messages and consume messages need to re-create a connection 1. Create a channel with the same model based on java nio connection multiplexing multiple connections and multiple consumers who generate a multiplexed connection, avoiding both producers and consumers for each creation a connection
But beware channel is not shared by the threads need to create a channel can not be a thread for each thread to create a channel to transmit the message and then gave a message thread b b thread should create another channel
What is the AMQP protocol
The above architecture model by routing key delivery message producer to exchage exchage The binding key route to the specific page queue 26