Apache ActiveMQ

Just for fun, I am interested with building a chat system using Apache ActiveMQ, a messaging broker. ActiveMQ supports multiple messaging protocols, and I am interested with the STOMP protocol.

Download and Install

On Mac OS X, ActiveMQ can be installed using Homebrew:

brew install activemq

On Linux and Cygwin, ActiveMQ can be installed by downloading the binary package from http://activemq.apache.org/activemq-550-release.html.  Because ActiveMQ is written in Java, we need to install Sun’s J2SE for Windows if we want ActiveMQ run with Cygwin.

Start with STOMP Support

To make ActiveMQ support STOMP protocol, we can run it with a pre-distributed configure XML file:

cd activemq-install-directory
./bin/activemq-admin start xbean:./conf/activemq-stomp.xml

Write a Client

ActiveMQ can take charge of the server-side, but you need to write your own client program of the chatting system. A client library of the STOMP protocol in C is libstomp.  A slightly modified version of libstomp and a client program can be checked out from Google Code:

svn checkout https://yiwang-learning-projects.googlecode.com/svn/trunk/libstomp