RabbitMQ Java Interview

135. RabbitMQ usage scenarios What?

  • Buying activities, load shifting, to prevent system collapse.
  • Delay information processing, such as sending e-mail alert to a single non-payment of the user 10 minutes.
  • Decoupling system for new features can write a separate module expansion, such as user confirmation after evaluation, adds functionality to the user points back, this time without adding new features integrated in the business code, just need to add message queue Interface subscription confirmation to the evaluation of the integral, then later add any functionality only to subscribe to the message queue.

What are the important role 136. RabbitMQ there?

RabbitMQ have an important role: producers, consumers and agents:

  • Manufacturer: creator of the message, is responsible for creating and push data to the message server;
  • Consumer: a message receiver for processing data and an acknowledgment message;
  • Agent: RabbitMQ is itself, for playing the role of "express" itself does not produce a message, just play the role of "Express" is.
  • The ConnectionFactory (connection manager): application establishes a connection between the manager and the Rabbit, the program code used.
  • Channel (Channel): used in the feed channel message.
  • The Exchange (switch): for receiving, allocation message.
  • Queue (queue): storing a message producer.
  • RoutingKey (routing key): the data generator for assigning to the switch.
  • BindingKey (binding key): message for the exchanger bound to the queue.
  • vhost: Each RabbitMQ can create a lot vhost, we call virtual hosts, each virtual host are actually mini version of RabbitMQ, it has its own queue, switches and bindings, have their own rights mechanisms.
  • First, the client must connect to RabbitMQ server to publish and consume messages, will create a tcp connection between the client and rabbit server, once tcp open and certified (certification that you sent to the user name and password rabbit server), you the client and RabbitMQ created a amqp channel (channel), the channel is to create a virtual connection in the "real" tcp, and amqp commands are through channel sent out, each channel will have a unique id, whether it is released message, the subscription queue are completed through this channel.
  • It provides functionality affairs.
  • By setting the channel to confirm (acknowledgment) mode.
  • The message is persistent disk, restart the server to ensure that messages are not lost.
  • Each cluster has at least one physical disk, the disk falls guaranteed message.
  • Statement queue must be set to persist durable set to true.
  • Push message delivery persistent mode must be set, deliveryMode set to 2 (persistent).
  • Message has arrived persistent switch.
  • Message has arrived persistent queue.
  • These four conditions are met in order to ensure the message persistence to succeed.
  • Persistent lack of land is to reduce the throughput of the server because of a disk instead of using memory storage, thereby reducing throughput. Ssd hard drive can make use of to alleviate the problem of throughput.
  • direct (default): The simplest most basic mode, the sender sends a message to subscribers, if there are multiple subscribers, taking the default polling way messaging.
  • headers: with direct similar, but poor performance, almost less than this type.
  • fanout: distribution model, the consumer distributed to all subscribers.
  • topic: matching subscription model, then matched to a regular message queue can be matched to the can receive.

What are the important components 137. RabbitMQ there?

138. What is the role of the RabbitMQ vhost is?

139. RabbitMQ is how to send the message?

140. RabbitMQ how to ensure the stability of the message?

141. RabbitMQ how to avoid message loss?

142. To ensure that the message persistence conditions for success are there?

143. RabbitMQ persistence What are the disadvantages?

144. RabbitMQ There are several types of broadcast?

145. RabbitMQ how to achieve delayed message queue?

Delay queue achieved in two ways:

  • By entering the dead letter message expires switch, and then forwarded by the switch to the consumer queue delay, to achieve a delay function;
  • Use RabbitMQ-delayed-message-exchange plug-in implementation delay function.

146. RabbitMQ cluster what's the use?

Clustered mainly in the following two purposes:

  • Availability: a server problem, the entire RabbitMQ can continue to use;
  • High capacity: clusters can carry more information amount.
  • Disk node: the message will be stored to disk.
  • Memory Node: Messages are stored in memory, restart the server message loss, higher performance than disk type.
  • Used between nodes "--link" connection, this attribute can not be ignored.
  • erlang cookie value of each node must use the same, this value corresponds to the "keys" function for authenticating each node.
  • The entire cluster must contain a disk node.

Type of node 147. RabbitMQ What?

148. RabbitMQ cluster to build what issues need attention?

 

 

149. RabbitMQ is a complete copy of each node to other nodes do? why?

No, for two reasons:

  • Consider storage space: If each node has a complete copy of all the queues, so not only does not add nodes to add storage space, but adds more redundant data;
  • Performance considerations: If you need a complete copy of each message to each cluster node, the new node that does not improve the ability to handle messages up to maintain the same performance of a single node or even worse.

150. RabbitMQ cluster nodes only one disk crashes What happens?

If the only disk disk node crashes, can not do the following:

  • You can not create a queue
  • You can not create exchanger
  • You can not create a binding
  • You can not add users
  • You can not change the permissions
  • You can not add and remove cluster nodes

The only disk node crashes, the cluster can be kept running, but you can not change anything.

151. RabbitMQ cluster nodes required by the order to stop it?

RabbitMQ cluster stop order is required, it should turn off the memory node, and finally close the disk nodes. If the order is just the opposite, it may cause loss of messages.

Guess you like

Origin www.cnblogs.com/mjtabu/p/12580541.html