Chapter 10. Deploying a New Broker Instance
Abstract
Overview
Standalone containers
- Create a template Apache ActiveMQ XML configuration file in a location that is accessible to the container.
- In the JBoss Fuse command console, use the config:edit command to create a new OSGi configuration file.ImportantThe PID must start with
org.fusesource.mq.fabric.server-
. - 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
- 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".
- Save the new OSGi configuration using the config:update command.
${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
- Create a template Apache ActiveMQ XML configuration file in a location that is accessible to the container.
- 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. - 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 themq-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 themq-base
profile, but uses your XML configuration template, create a new container named containerName, and deploy the broker profile to it.NoteThe new container will be a child of the container from which you execute the fabric:mq-create command.
NoteYou can add network configuration settings to the profile as well. See section "Arguments" in "Console Reference". - 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".
Example
myBroker
that stores its data in InstallDir/data/myBroker
and opens a port at 61617, you would do the following:
- Open the JBoss Fuse command console.
- 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
- 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
- Use the config:propset command to specify the new broker's data directory:
JBossFuse:karaf@root>
config:propset data ${karaf.data}/myBroker
- Use the config:propset command to specify the new broker's name:
JBossFuse:karaf@root>
config:propset broker-name myBroker
- Use the config:propset command to specify the new broker's openwire port:
JBossFuse:karaf@root>
config:propset openwire-port 61617
- Save the new OSGi configuration using the config:update command.