I. Basic Concepts As part of the J2EE system standard, JMS specifies the specifications for sending and receiving messages synchronously and asynchronously between applications. Activemq is a message server that implements the JMS standard. Several important concepts of activemq: 1.
Client: activemq The client includes two types: producer and consumer. It can be seen from the name that producer is the producer of the message that generates the message, consumer is the consumer of the message that receives the message, and in reality producer and consumer are two applications. Program Between them through Activemq for communication. 2.
Destination : The target of the message to be sent, the source of the message to be received. Two types are available: queue and topic. Messages in a queue can only be consumed once. messages in a topic can be consumed by all subscribers at the same time. Pay attention to a time series relationship. For queue, you can send messages before receiving them; For a topic, a subscriber can only receive messages generated after the subscription starts, but cannot receive messages generated before the subscription, similar to a newspaper subscription. . 3.
Persistence : Activemq supports persistence and saves received messages to the database. Even if activemq is restarted, messages that have not been distributed can still be sent. 4.
Asynchronous : The biggest feature of activemq is Asynchronization, which is also the biggest difference With WebService. The sender only needs to send the message to activemq, and the rest is sent to activemq.
Ii. Installation
Download from the official website: Http://www.apache.org/dyn/closer.cgi? Path =/activemq/Apache-activemq/5.8.0/apache-activemq-5.8.0-bin.zip
Download the package and decompress it to a directory. Note that this directory must allow normal users to create files.
Configure environment variables: Add
Activemq_ Home, pointing to the installation directory
Path Add \ AC
Tivemq_home % \ bin \
Classpath Join
\ ACTivemq_home % \ conf \
Run activemq: Run:
Activemq The log is started normally if no error is reported.
Test whether the installation is successful: Activemq's default port is 61616. Open another console and use the netstat command to search for port 61616:
Netstat-an | find"61616"
Monitor activemq: We can monitor activemq through the web interface and access it through a browser:Http: // localhost: 8161/admin If activemq version is 5.8, enter the default accountAdmin/admin, This account You can
Conf/jetty-real.properties Configuring
Stop activemq: Go directly to runActivemqRun Ctrl + C on the console.