There are a few example programs to test out ActiveMQ in the org.activemq.tool package in the unit test area.
Before running the examples you should try running a JMS broker on your machine. Follow the Installation instructions to use a binary distribution of ActiveMQ.
If you are working from the source code then you can do this by running the main() in the org.activemq.broker.impl.Main class inside your IDE.
Another option is to run it from inside Maven in the assembly module
Running the examples from a binary distro
You can use Ant to compile and run the examples. To run the examples try
In another shell
You should then see messages being produced and consumed. Pass additional commands into these goals using variables. (See the build.xml for more details). e.g.
For a summary of all the available goals try
Running the examples from the source
For all of these examples you can specify specific URLs to connect to or run a server on as we shall see below.
You can run the example programs from inside your IDE as they are stand alone Java applications. e.g. ConsumerTool consumes on a topic/queue and PublisherTool publishes on a topic/queue.
You can run them from inside Maven via the following.
for the producer
You can specify a subject to publish/consume on too
You can mix and match url and subject parameters. If neither are specified then defaults are used.