Apache ActiveMQ
From Oxxus Wiki
The Apache ActiveMQ is one of today's most popular and powerful, open source messaging and Integrations patterns server released under the Apache 2.0 License.
It supports Cross Language Clients and Protocols, with Enterprise Integration Patterns.
It also provide support for JMS 1.1 and J2EE 1.4.
Server application can be downloaded from official download pages.
There are few requirements that have to be met in order to successfully install server software.
- Hardware
-
- 33 MB of free disk space for the ActiveMQ 4.x binary distribution.
- 200 MB of free disk space for the ActiveMQ 4.x source or developer's distributions.
- Operating Systems
-
- Windows: Windows XP SP2, Windows 2000, Windows Vista, Windows 7.
- Unix: Ubuntu Linux, Powerdog Linux, MacOS, AIX, HP-UX, Solaris, or any Unix platform that supports Java.
- Environment
-
- Java Developer Kit (JDK) 1.4.x or greater for deployment and 1.5.x (Java 5) for compiling/building.
- The JAVA_HOME environment variable must be set to the directory where the JDK is installed, e.g., c:\Program Files\jsdk.1.4.2-09.
- Maven 1.0.2 or greater (required when installing source or developer's releases).
- JARs that will be used must be added to the classpath.
In following text, only Linux OS related installing and configuration will be presented.
As it's the case with most of Linux OS applications, it can be installed from binary or from source distribution.
Binary Installation
Download the activemq gzip file to the Unix machine, using either a browser or a tool, i.e., wget, scp, ftp, etc. for example:
wget http://activemq.apache.org/path/tofile/apache-activemq-4.1.0-incubator.tar.gz
- Extract the files from the gzip file into a directory of your choice. For example:
tar zxvf activemq-x.x.x.tar.gz
- If the ActiveMQ start-up script is not executable, change its permissions. The ActiveMQ script is located in the bin directory. For example:
cd [activemq_install_dir]/bin; chmod 755 activemq
- Proceed to the Starting ActiveMQ section of this document.
- Following start-up, go to the Testing the Installation section.
If you don't already have a VPS, our java hosting is a good place to start. Description of what Apache ActiveMQ hosting you need, will be useful.
Source Installation
The ActiveMQ works with Java 1.4.x but to compile and build ActiveMQ, Java 1.5 is required.
From a browser, navigate to activemq.apache.org.
- Click the Download link in the navigation pane (the left pane).
- Click the ActiveMQ 4.x Release link under the "Latest Releases" section. This brings up a new page.
- Under the Download Here section, select the desired distribution (if necessary, scroll down to see the "Download Here" section). For a source distribution, the filename will be similar to: activemq-x.x-src.tar.gz.
- Extract the files from the ZIP file into a directory of your choice. For example:
tar zxvf activemq.x.x-src.tar.gz
- Build ActiveMQ using Maven 2.0.4 or greater and Java 5: The preferred method of building ActiveMQ is the following:
cd [activemq_install_dir]; mvn clean install
If Maven crashes with a java.lang.OutOfMemoryError, you you need to do this first (assuming a Bourne-like shell):export MAVEN_OPTS=-Xmx512M
If the above build fails on some tests, do the following:cd [activemq_install_dir]; mvn clean install -Dmaven.test.skip=true
If you prefer to use an IDE then you can auto-generate the IDE's project file using maven plugins:mvn eclipse:eclipse
ormvn idea:idea
Feel free to use any other applicable IDE. Please refer to the plugin reference for more details. NOTE: Working directories get created relative to the current directory. To create working directories in the proper place, ActiveMQ must be launched from its home/installation directory. - Proceed to the Starting ActiveMQ section of this document.
- Proceed to Testing the Installation section.
Starting/Stopping ActiveMQ
To start ActiveMQ server just access server's shell prompt and change to the installation directory.
Type following commands:
bin/activemq
OR
bin/activemq > /tmp/smlog 2>&1 &;
Note: /tmp/smlog may be changed to another file name.
You can test ActiveMQ with command below, also issued at server's shell prompt.
netstat -an|grep 61616
To stop ActiveMQ, from shell prompt use commands as follows
ps -ef|grep activemq kill [PID]
Where [PID] is the process id of the ActiveMQ process.