RabbitMQ a personal summary

1, fair distribution of work queue

  1.1, using the fair distribution must turn off the automatic reply, ack to manual

Producer: Consumer 1: Consumer 2:

Second processing message consumers than a consumer (ADM)


 

 

2, message response and message persistence

 autoAck: Boolean type (true, false)

true: rabbit distribute messages to consumers, will be removed from memory

     If you kill the consumer is doing, it will lose the information being processed

false: If you have a consumer hang up, consumers will be handed over to another for processing, rabbitmq support message response

 Consumers send a reply message to tell the news rabbitmq processing is complete, you can delete. After rabbitmq will delete messages in memory

The default response message is false (open state)

Boolean autoAck=true;
channel.basicConsume(QUEUE_NAME, autoAck, consumer);

 
Message persistence: 
Boolean = Durable to false;
channel.queueDeclare ( queue_name , Durable, to false, to false, null) ;
durable = false true not changed; 
change error code is not true, but the errors will run
rabbitmq allowed to redefine an existing queue

3, subscription model 
interpretation:
1, a producer, a plurality of consumers
2, every consumer has its own queue
3, the producer does not send the message to the queue but to switch
4, each queue must be tied fixed to the switch
5, the message sent by the producer through the switch to a message queue can be realized by a plurality of consumer spending

 


 

 

   

 

Guess you like

Origin www.cnblogs.com/caiwx/p/11244761.html