此内容没有您所选择的语言版本。
Chapter 17. 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.
17.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/activemq.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-broker.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 17.1, “Configuring the Default Broker's Data Directory”.
Example 17.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:update
Disabling the default broker
If you do not want to use the default broker, you can disable it by removing its OSGi configuration file. There are two procedures to follow, depending on whether a Karaf container has been started:
If no Karaf container has been started:
- Delete
FUSE_HOME/etc/io.fabric8.mq.fabric.server-broker.cfg
.
If you have already started a Karaf container, use the following instructions whilst JBoss Fuse is running.
- From the JBoss Fuse command console, list the JBoss Fuse brokers:
activemq:list
The result should look like this:brokerName = amq
- List the configuration PID files:
config:list | grep io.fabric8.mq.fabric
The result will look like this:Pid: io.fabric8.mq.fabric.server.cd4295e7-1db9-44b6-9118-69011a0f09a3 FactoryPid: io.fabric8.mq.fabric.server fabric.zookeeper.pid = io.fabric8.mq.fabric.server felix.fileinstall.filename = file:/home/username/product/fuse-630/jboss-fuse-6.3.0.redhat-187/etc/io.fabric8.mq.fabric.server-broker.cfg service.factoryPid = io.fabric8.mq.fabric.server service.pid = io.fabric8.mq.fabric.server.cd4295e7-1db9-44b6-9118-69011a0f09a3 Pid: io.fabric8.mq.fabric.standalone.server.4de976b1-2fae-4391-97d9-3a08876e39ab FactoryPid: io.fabric8.mq.fabric.standalone.server felix.fileinstall.filename = file:/home/username/product/fuse-630/jboss-fuse-6.3.0.redhat-187/etc/io.fabric8.mq.fabric.server-broker.cfg mq.fabric.server.pid = io.fabric8.mq.fabric.server.cd4295e7-1db9-44b6-9118-69011a0f09a3 service.factoryPid = io.fabric8.mq.fabric.standalone.server service.pid = io.fabric8.mq.fabric.standalone.server.4de976b1-2fae-4391-97d9-3a08876e39ab
- Delete the configuration PID files labeled
Pid:
in the example above.config:delete io.fabric8.mq.fabric.server.cd4295e7-1db9-44b6-9118-69011a0f09a3 config:delete io.fabric8.mq.fabric.standalone.server.4de976b1-2fae-4391-97d9-3a08876e39ab
Note that your files will have the same names as those shown above until the last numeric portion of the the file name, which is a system generated ID for the broker. Replace the filenames in the instructions with your actual filename. - List the JBoss Fuse brokers again:
activemq:list
The deleted broker will not appear. - To permanently delete the default broker:Stop the JBoss Fuse instance.Delete file
FUSE_HOME/etc/io.fabric8.mq.fabric.server-broker.cfg
.Restart the JBoss Fuse instance and run theactivemq:list
command. The deleted broker will not appear.