ActiveMQ——activemq Detailed description of ,queue,topic The difference between （ selected ）
JMS Two message models are defined in ： Point to point （point to point, queue） And release / subscribe （publish/subscribe,topic）. The main difference is
Whether it can be re consumed .
Point to point ：Queue, Unrepeatable consumption
Message producer production message sent to queue in , Then the message consumer from queue To retrieve and consume messages .
After the news is consumed ,queue No more storage in , So it's impossible for news consumers to consume the information that has been consumed .
Queue Support multiple consumers , But for a message , Only one consumer can consume , Others cannot consume this message .
When the consumer does not exist , Message will be saved all the time , Until there is consumption
release / subscribe ：Topic, Can be re consumed
Message producer （ release ） Publish message to topic in , Multiple message consumers at the same time （ subscribe ） Consume the message .
Different from point-to-point , Publish to topic Will be consumed by all subscribers .
When the producer publishes a message , Whether there are consumers or not . No messages will be saved
Jms Two kinds of norms message transmission mode Topic and Queue, The comparison between the two is as follows ()：
outline Publish Subscribe messaging Publish subscription message Point-to-Point Point to point
Status or not topic Data does not land by default , Is stateless .
Queue By default, the data will be mq Saved as a file on the server , such as Active
MQ Generally stored in $AMQ_HOME\data\kr-store\data below . It can also be configured as DB storage .
Integrity assurance There is no guarantee publisher Every data published ,Subscriber It's acceptable . Queue Ensure that every data can be receiver receive .
Whether the message will be lost
generally speaking publisher Publish a message to a topic Time , Only listening for this topic Of address sub Able to receive messages ; without sub Monitoring , The topic It's lost .
Sender Send message to destination Queue,receiver You can receive this asynchronously Queue Message on .Queue If there is no message on receiver Come and get it , It will not be lost .
Message publishing and receiving policy One to many strategy for message publishing and receiving , Monitor the same topic Multiple addresses sub You can get it publisher Messages sent .Sub Receive notification mq The server
A one-to-one strategy for message publishing and receiving , One sender Messages sent , Only one receiver receive .receiver After receiving , notice mq Server received ,mq Server pair queue Delete or other actions are taken for messages in .