Versions Compared

Key

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

ActiveMQ integration

ServiceMix 4 integrates nicely with ActiveMQ. A feature is available through the Kernel provisioning system, but this already comes pre-installed with the ServiceMix 4 distribution.

A set of commands enable the creation, destruction and querying of ActiveMQ brokers:

Code Block
servicemix> activemq help

Available commands in activemq:
  browse                Display selected messages in a specified destination
  bstat                 Displays useful broker statistics
  create-broker         Creates a broker instance.
  destroy-broker        Destroys a broker instance.
  list                  Lists all available brokers in the specified JMX context
  purge                 Delete selected destination's messages that matches the message selector
  query                 Display selected broker component's attributes and statistics
Tip
titleHelp on commands

To obtain some detailed help on a given command, you can run:

Code Block
activemq help [command] 

Broker creation

By default, no broker is created, but the following command can be used to create one:

Code Block
servicemix> activemq create-broker
Creating file: xxx/deploy/localhost-broker.xml

Default ActiveMQ Broker (localhost) configuration file created at: xxx/deploy/localhost-broker.xml
Please review the configuration and modify to suite your needs.  

It creates a broker with a sensible default configuration, but you can easily edit the mentioned file to modify the broker's configuration. Along with the broker, a pooled JMS ConnectionFactory is registered in OSGi and the broker is integrated with the transaction manager embedded in ServiceMix. The broker is also registered in the local JMX mbean server.

If you want to create multiple brokers, you need to give them some names. This can be done this way:

Code Block
servicemix> activemq create-broker --name mybroker 
Creating file: xxx/deploy/mybroker-broker.xml

Default ActiveMQ Broker (mybroker) configuration file created at: xxx/deploy/mybroker-broker.xml
Please review the configuration and modify to suite your needs.  

Broker destruction

To remove an existing broker, simply run the following command:

Code Block
servicemix> activemq destroy-broker

Default ActiveMQ Broker (localhost) configuration file created at: xxx/deploy/localhost-broker.xml removed.

To destroy a named broker, run the following command:

Code Block
servicemix> activemq destroy-broker --name mybroker

Default ActiveMQ Broker (localhost) configuration file created at: xxx/deploy/mybroker-broker.xml removed.

Broker querying

Several commands are available to query the broker. To address local brokers, you need to use the --jmxlocal parameter.

The following command displays available brokers:

Code Block
servicemix> activemq list --jmxlocal
BrokerName = mybroker

To have more detailed informations, run:

Code Block
servicemix> activemq query --jmxlocal

It will display informations about the connectors, list of queues, etc...

You can also browse or purge queues using the activemq browse and activemq purge commands.