Chapter 10. Deploying a New Broker Instance

Abstract

Red Hat JBoss Fuse supports the deployment of multiple JMS brokers in a container. Doing so involves creating a new set of broker configurations and deploying them to the container.

Overview

Deploying a new broker instance involves creating a new OSGi broker configuration and deploying it into the container. In a standalone container this can be done from the command console using the config command shell. For containers deployed in a fabric, you need to either create a profile for the new broker, or modify an existing profile to include the new broker configuration.
You will also likely want to create a new Apache ActiveMQ template configuration file that allows you to modify the desired settings. This will involve creating a new Apache ActiveMQ XML file and making it accessible to container.

Standalone containers

To deploy a new broker into a standalone container:
  1. Create a template Apache ActiveMQ XML configuration file in a location that is accessible to the container.
  2. In the JBoss Fuse command console, use the config:edit command to create a new OSGi configuration file.
    Important
    The PID must start with org.fusesource.mq.fabric.server-.
  3. Use the config:propset command to associate your template XML configuration with the broker OSGi configuration as shown in Example 10.1, “Specifying a Broker's Template XML Configuration”.

    Example 10.1. Specifying a Broker's Template XML Configuration

    JBossFuse:karaf@root> config:propset config configFile
  4. Use the config:propset command to set the required properties.
    The properties that need to be set will depend on the properties you specified using property place holders in the template XML configuration and the broker's network settings.
    For information on using config:propset see section "Details" in "Console Reference".
  5. Save the new OSGi configuration using the config:update command.
Once the new OSGi configuration is saved the new broker instance will start.
Note
If you want to simply deploy a second broker that uses the default configuration template skip Step 1. You will need set the config property to ${karaf.base}/etc/activemq.xml. You will also need to provide values for the data property, the broker-name property, and the openwire-port property.

Fabric containers

To deploy a new broker into a container in a fabric:
  1. Create a template Apache ActiveMQ XML configuration file in a location that is accessible to the container.
  2. In the JBoss Fuse command console, use the fabric:import command to upload the your XML configuration template to the Fabric Ensemble as shown in Example 10.2, “Uploading a Template to a Fabric Ensemble”.

    Example 10.2. Uploading a Template to a Fabric Ensemble

    JBossFuse:karaf@root> fabric:import -t /fabric/configs/versions/version/profiles/mq-base/configFile configFile
    version must match the version of the new profile you will create for the new broker.
  3. Use the fabric:mq-create command to create a profile for the new broker and assign it to a container.
    • To deploy the new broker into an existing container use the command shown in Example 10.3, “Creating a New Broker in an Existing Container”

      Example 10.3. Creating a New Broker in an Existing Container

      JBossFuse:karaf@root> fabric:mq-create --assign-container containerName --config configFile profileName
      This will create a new broker profile that inherits from the mq-base profile, but uses your XML configuration template, and deploy it to the specified container.
    • To deploy the new broker into an new container use the command shown in Example 10.4, “Creating a New Broker in a New Container”

      Example 10.4. Creating a New Broker in a New Container

      JBossFuse:karaf@root> fabric:mq-create --create-container containerName --config configFile profileName
      This will create a new broker profile that inherits from the mq-base profile, but uses your XML configuration template, create a new container named containerName, and deploy the broker profile to it.
      Note
      The new container will be a child of the container from which you execute the fabric:mq-create command.
    Note
    You can add network configuration settings to the profile as well. See section "Arguments" in "Console Reference".
  4. Use the fabric:profile-edit command shown in Example 10.5, “Editing a Broker Profile” to set the required properties.

    Example 10.5. Editing a Broker Profile

    JBossFuse:karaf@root> fabric:profile-edit --pid org.fusesource.mq.fabric.server-profileName/property=value profileName
    The properties that need to be set will depend on the properties you specified using property place holders in the template XML configuration and the broker's network settings.
    For information on using fabric:profile-edit see section "Description" in "Console Reference".
Note
If you want to simply deploy a second broker that uses the default configuration template skip Step 1 and Step 2.
Note
The management console makes this process easier by providing a Web based UI.

Example

If you wanted to deploy a new instance of the default broker called myBroker that stores its data in InstallDir/data/myBroker and opens a port at 61617, you would do the following:
  1. Open the JBoss Fuse command console.
  2. In the JBoss Fuse command console, use the config:edit command to create a new OSGi configuration file:
    JBossFuse:karaf@root> config:edit org.fusesource.mq.fabric.server-myBroker
  3. Use the config:propset command to associate your template XML configuration with the broker OSGi configuration:
    JBossFuse:karaf@root> config:propset config ${karaf.base}/etc/activemq.xml
  4. Use the config:propset command to specify the new broker's data directory:
    JBossFuse:karaf@root> config:propset data ${karaf.data}/myBroker
  5. Use the config:propset command to specify the new broker's name:
    JBossFuse:karaf@root> config:propset broker-name myBroker
  6. Use the config:propset command to specify the new broker's openwire port:
    JBossFuse:karaf@root> config:propset openwire-port 61617
  7. Save the new OSGi configuration using the config:update command.