RabbitMQ-- operating mode

1, the work queue

  • Two common consumer end consumer with a message in the queue. For the task is too heavy or task in many cases, the use of the work queue can improve the speed of processing tasks. An accepted message will only be a consumer; adopts the polling manner average transmission message to the consumer; consumers will receive the message after processing a message.

2, message / subscribe model

  • Each consumer monitor its own queue; producer sends a message to the broker, the switch will forward the message to every queue bind this switch, each binding switch queue will receive the message.

3, routing mode (the Routing)

  • Each consumer listens own queue, provided routingkey; producer will send messages to the switch, the switch forwards the message according to a specified queue routingkey.

  • Routing queue when binding mode requires a switch to specify routingkey, the message will be forwarded to conform routingkey queue.

4, wildcard pattern (Topics)

  • Each consumer listens own queue, and is provided with a wildcard routingkey; Broker sends a message to the producer, the switch forwards the message according to a specified queue routingkey.

  • The user notification is provided to inform the user, disposed to receive Email user receives only the Email, the user is provided only received sms sms reception, the two types of notification provided two types of notification types are received are valid.

  • Symbol #: matching one or more words, such as # Inform match inform.sms, inform.email, inform.sms.email like;.

  • Symbol: only match a word, for example, inform * can match inform.sms, inform.email..

5, Header mode

  • header pattern different from that where routing, header mode is canceled routingkey, using the header of the key / value (key-value pairs) match queue.
  • The user notification is provided to inform the user, disposed to receive Email user receives only the Email, the user is provided only received sms sms reception, the two types of notification provided two types of notification types are received are valid.

6, RPC mode

  • That RPC client calls the remote server approach, using MQ can implement asynchronous RPC call to achieve based on Direct switch process is as follows:
    • The client is the consumer that is the producer, the RPC request queue to send the message RPC call while listening RPC response queue.
    • The server listening for messages RPC request queue, the method of performing server after receiving the message, the method returns to obtain the results.
    • The server transmits the results to the RPC RPC method response queue.
    • Client (RPC caller) RPC response queue listener receives the RPC call result.

Guess you like

Origin www.cnblogs.com/Mhang/p/12299594.html