How to use the ActiveMQ console

Source: Internet
Author: User


First, why use ACTIVEMQ

The JMS (Java Message Service) channel may be used in the design of the bus, and the Java Messaging Services (JMS) goes beyond the manufacturer's proprietary mom (Message-oriented-middleware) API. It provides a set of APIs for enterprise messaging. The goal of JMS is to provide a standard API that uses the Java language to send and receive messages in a producer-neutral manner. The JMS API minimizes the amount of enterprise messaging knowledge that a Java programmer should have to develop complex messaging applications, while still maintaining some portability across JMS provider implementations.

JMS itself is not a mom. It is an API that abstracts the interaction between the messaging client and mom, similar to the JDBC abstraction of the relational database interaction. Communication between applications is sent to MOM by applying a JMS message to the 1 organization using the JMS API, and application 2 receives the message through the JMS API for processing, which enables the processing of messages synchronously or asynchronously, which is used in our project by MOM is ACTIVEMQ------ An open source message middleware.

ii. version and description of the ACTIVEMQ used in the bus

The version of ACTIVEMQ used in the bus is 5.3.0, and the download address is http://activemq.apache.org/ DOWNLOAD.HTML,ACTIVEMQ required JDK version of the minimum is 1.5 so before installing ACTIVEMQ must be sure that the JDK version is 1.5, ActiveMQ5.3.0 is free to install the download after the decompression to the appropriate location, open the root directory will see the following files:

Figure One ACTIVEMQ directory format

* license--contains the LICENSE of the library used by ACTIVEMQ.

* notice--It contains copyright information for ACTIVEMQ Use library

* readme.txt--Novice Documentation

* webconsole-readme.txt--contains information that uses Activemqweb conslole.

* activemq-all-5.3.0.jar--contains all the contents of ACTIVEMQ, it is convenient to use it, it is enough to import this jar directly in the place where activemq is used.

* bin--contains binary/executable files of ACTIVEMQ; Startup scripts are also in this directory

* conf--holds ACTIVEMQ all configuration information

* data--log files and message persistence data are saved in this directory.

* docs--contains a simple index.html file that points to the ACTIVEMQ URL

* example--example; we'll use it to quickly test ACTIVEMQ

* Lib--lib directory holds all libraries required for ACTIVEMQ

* user-guide.html--a short guide to starting ACTIVEMQ and running the sample

* Webapps--webapps Directory holds ACTIVEMQ Web console and some other web-related demos

Iii. starting and using the ACTIVEMQ console

Go to the Activemq\bin directory to find Activemq.bat Click Start Activemq, the normal start interface is as follows:

Figure two activemq normal start interface

Access http://localhost:8161/admin/index.jsp View ACTIVEMQ management interface in this interface you can add, delete, clear the message information to view the queue topics and new, delete topics and queues and other features, The use of the console is very simple here no longer repeat it.

Figure three ACTIVEMQ Console

four, from a simple example to see the use of Activemq

This example is a simple example of sending a message: an example sends a TEXTMESSAGE message to ieslab.chen that the content of the message is Hello World. Take a look at the console: Click the queue link on the console, and then you can see that there is a ieslab.chen on the name below the queues as shown in Figure four:

Figure IV Viewing messages from the console



Name displayed in console: is the name of the queue, number ofpending Messages is the amount of messages waiting to be consumed, number of consumers is the quantity of consumers, Messages enqueued is a message in the queue, Messages dequeued is the number of messages consumed, views can be viewed to specify a consumer, operation specifies the action on the queue: send, empty, delete. Click the name of this queue jms.ieslab.chen you can see the messages in this queue click on a message to see the details of the message as shown in Figure five:

Figure v. Viewing the details of a message using the console

Here is the code used in the example: (Note *prop.setproperty (Context.provider_url, "tcp://localhost:61616");// 172.20.9.39 This place must be aware that under the ACTIVEMQ root directory there is a conf folder under the Activemq.xml is set ACTIVEMQ details below is a configuration about the connection of the following code:< Transportconnectors>

<transportconnector name= "Openwire" uri= "tcp://localhost:61616"/>

<!--transportconnectorname= "Openwire1" uri= "tcp://0.0.0.0:61617"/-

</transportConnectors>

If the TCP connection set up in your activemq.xml is localhost then you cannot use your own IP in the code, which means you cannot write this prop.setproperty (Context.provider_url, "tcp:// 172.20.9.39:61616 ") (172.20.9.39 is my IP)).



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.