Detailed Rabbitmq switch

rabbitmq switch

1. Function:

Receive the message from the producer, and then deliver the message to the corresponding queue bound to the exchange according to the routing key routingKey

 

2. Properties

Name: The name of the switch
Type: The type of the switch, direct, topic, fanout, headers
Durability: Whether to persist
autodelete: If no queue is bound to the switch, the switch will automatically delete
Internal: Whether the current switch is used internally by rabbitmq Not commonly used, the default is false
Argurements: extended parameters, users extend AMQP customized protocol

 

3. Type

1. Direct exchange: direct exchange

The direct exchange messages sent will be delivered to the exchange-queue with the same name as the routingKey bound to the exchange and queue.
**: In direct mode, rabbitmq can be used to customize the exchange----> default exchange so it is not required The switch is bound to any queue, and the
message will be delivered to the queue with the same routingKey name and queue name

 

 

2. TopicExchange

It is the routingKey tied to the top switch on the queue, which can be matched by wildcards

The rules for wildcard characters are, for
   example: log.#: can match one word or multiple words. For example, log.# can match log.a log.ab, that is, all words starting with log are acceptable

             #.order: It can match project1.order or project2.order messages, that is, all messages ending in order are ok


        log.* can match a word, for example log.* can match log.a but not log.ab

 

3. Fanout exchange

That is, the message passes from the exchange to the queue and does not pass the routing key, so the speed of this mode is the fastest. As long as it
is bound to the exchange, the message will be distributed to the queue bound to it.

Guess you like

Origin blog.csdn.net/qq_27471405/article/details/107448989