Child pages
  • Examples

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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 server on your machine. 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

Code Block

maven server 

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.

Code Block

maven consumer -Durl=tcp://localhost:61616

for the producer

Code Block

maven producer -Durl=tcp://localhost:61616

You can specify a subject to publish/consume on too

Code Block

maven producer -Dsubject=COM.ACME.MYQUEUE

You can mix and match url and subject parameters. If neither are specified then defaults are used.

Include Page
Version 5 Examples
Version 5 Examples