First, what is ACTIVEMQ?
ACTIVEMQ is a message middleware (message-oriented middleware,mom) that implements JMS1.1 specifications, supports more than j2ee1.4, supports multiple language clients (Java,c,c++,ajax, etc.), Supports multiple protocols (HTTP,HTTPS,IP multicast, SSL protocol, STOMP Protocol, TCP protocol, UDP protocol, etc.) and good spring support.
Second, ACTIVEMQ and RPC comparison
1, can achieve decoupling between the system;
2, RPC is synchronous communication, ACTIVEMQ default is asynchronous communication, of course, it can also support synchronous communication;
3, ACTIVEMQ Self-supporting simple authorization and authentication method, can be configured by the properties file to achieve ;
4, can be Tomcat, jetty and other server integration;
5, support cluster, simple management and control.
Third, installation Activemq
can go to the official website to download the corresponding version of the binary package (http://activemq.apache.org/download-archives.html), unpacked on Windows, Go to Apache-activemq-x.x.x\bin\activemq.bat to run the ACTIVEMQ program; if it is on Linux, use the command tar zxvf Activemq-x.x.x.tar.gz unpacked to a directory can be used.
ACTIVEMQ may require the following port 1099 (JMX), 61616 (default transportconnector)
Windows View listening ports:
netstat -an|find "
61616
"
Linux systems:
netstat -an|grep
61616
运行后可以打开web控制台:
Http://localhost:8161/admin
If you can open the console page, the installation is successful.
Iv. Message processing mechanism queue (peer to peer mode) and topic (Pub\sub Publish subscription mode)
|
Topic |
Queue |
Profile |
Publish Subscribe Messaging Publish subscription message |
Point-to-Point point-to-point |
There is no status |
Topic data is not landed by default and is stateless |
Queue data is saved as a file by default on the MQ server, such as Active MQ, which is typically stored under $amq_home\data\kr-store\data. Can also be configured as DB storage |
Integrity Assurance |
There is no guarantee that every piece of data published by publisher will be accepted by subscriber |
Queue guarantees that each piece of data is received by receiver |
message is missing |
In general, when Publisher publishes a message to a topic, only the sub that is listening to the topic address can receive the message, and if no sub is listening, the topic loses the |
Sender sends a message to the target Queue,receiver can receive the message on this queue asynchronously. Messages on the queue will not be lost if receiver is not being picked for the time being |
message publish receive policy |
a one-to-many message issuance receive policy that listens to multiple sub-topic addresses to receive messages sent by publisher. Sub receives notification MQ server |
One message to publish the receive policy, a sender sends a message that only one receiver receives. When receiver is finished, notifies the MQ server that it has received the MQ server to take a delete or other action on the message in the queue |
The biggest difference between the topic and the queue is that the topic is in the form of a broadcast that notifies all online listeners that there is a new message, that the client without the listener will not receive the message, and that the queue notifies more than one client in the listening state in the form of a point-to-point.
ACTIVEMQ Message Queuing-Introduction