Chapter 14. JMS Broker

Abstract

Red Hat JBoss Fuse supports the deployment of JMS brokers. By default, it deploys an Apache ActiveMQ JMS broker. It includes all of the required bundles to deploy additional Apache ActiveMQ instances by deploying a new broker configuration.

14.1. Working with the Default Broker

Abstract

Red Hat JBoss Fuse starts up with a message broker by default. You can use this broker as it is for your application, or you can update its configuration to suite the needs of your application.

Overview

When you deploy a Red Hat JBoss Fuse instance, whether as a standalone container or as a part of a fabric, the default behavior is for a Apache ActiveMQ instance to be started in the container. The default broker creates an Openwire port that listens on port 61616. The broker remains installed in the container and activates whenever you restart the container.

Broker configuration

The default broker's configuration is controlled by two files:
  • etc/broker.xml—a standard Apache ActiveMQ configuration file that serves as a template for the default broker's configuration. It contains property place holders, specified using the syntax ${propName}, that allow you to set the values of the actual property using the OSGi Admin service.
  • etc/io.fabric8.mq.fabric.server-default.cfg—the OSGi configuration file that specifies the values for the properties in the broker's template configuration file.
For details on how to edit the default broker's configuration see the JBoss A-MQ documentation.

Broker data

The default broker's data is stored in data/activemq. You can change this location using the config command to change the broker's data property as shown in Example 14.1, “Configuring the Default Broker's Data Directory”.

Example 14.1. Configuring the Default Broker's Data Directory

JBossFuse:karaf@root> config:edit io.fabric8.mq.fabric.server.3e3d0055-1c5f-40e3-987e-024c1fac1c3f
JBossFuse:karaf@root> config:propset data dataStore
JBossFuse:karaf@root> config:exit

Disabling the default broker

If you decide that you don't want to use the default broker, you can disable it by removing it's OSGi configuration file:
  1. From the JBoss Fuse command console, delete the configuration PID using the config:delete command as shown in Example 14.2, “Deleting the Default Broker Configuration”.

    Example 14.2. Deleting the Default Broker Configuration

    JBossFuse:karaf@root> config:delete io.fabric8.mq.fabric.server.xxx
    xxx is the system generated ID for the broker. You can find this value using the config:list command.
  2. From the system terminal, delete the actual configuration file etc/io.fabric8.mq.fabric.server-default.cfg.
It is important to do both steps. Step 1 removes the broker from the running container and its cached deployment information. Step 2 removes the broker's configuration from the file system and ensures that it will not be automatically reloaded if the container is restarted.