Message broker configuration

In this section, we will take a look at how the message broker is integrated into Apache Geronimo, and, look into the various configuration options that Apache Geronimo provides for configuring the Apache ActiveMQ message broker.

GBean configuration

The broker is instantiated and started in the org.apache.geronimo.configs/activemq-broker/2.1.4/car configuration. This configuration has two GBeans. ActiveMQ is the GBean that creates an instance of the broker and then starts it. The implementation class of this GBean is org.apache.geronimo.activemq.BrokerServiceGBeanImpl. This GBean only provides a few configuration attributes, but these attributes are enough to configure ActiveMQ. The attributes provided are as follows:

  • brokerName: A name for this broker instance

  • dataSource: The JNDI name of the data source used for storing ActiveMQ message store data

  • dataDirectory: The directory where the ActiveMQ message store data is stored. It is also used to store logfiles.

  • brokerUri: The path of the broker configuration XML deployment descriptor

  • useShutdownHook: A Boolean value indicating whether the embedded ActiveMQ broker instance should use a shutdown hook or not.

The values for these attributes, for the ActiveMQ GBean, can be found in the deployment plan for the broker configuration. This is shown below:

<gbean name="ActiveMQ" class="org.apache.geronimo.activemq.BrokerServiceGBeanImpl">
<!-- Instead of using the limited configuration syntax in this file, you can set the brokerUri property to externally specify the configuration for the broker.
<attribute name="brokerUri">xbean:file:/path/to/activemq.xml </attribute>
-->
<!--
<attribute name="brokerName">possibly-unique-broker </attribute>
-->
<attribute name="useShutdownHook">false</attribute>
<attribute name="dataDirectory">var/activemq</attribute>
<reference name="dataSource">
<name>NoTxDatasource</name>
</reference>
<reference name="manager">
<name>ActiveMQManager</name>
</reference>
<reference name="serverInfo">
<name>ServerInfo</name>
</reference>
<reference name="mbeanServerReference">
<name>MBeanServerReference</name>
</reference>
</gbean>

Here, a dataDirectory value of var/activemq, results in a data directory of <GERONIMO_HOME>/var/activemq.

The useShutdownHook property is set to the default value of false, in order to inform the broker to not use a shutdown hook, as the broker will be shut down by the Apache Geronimo kernel. We can modify these values by making changes to the config.xml file in the <GERONIMO_HOME>/var/config directory. The change to be made is to add a <gbean> tag to the corresponding configuration entry in config.xml after stopping the server, followed by restarting the server.

You should edit the config.xml file only when the server is stopped. When the server is started, it reads the config.xml file into the memory and then it may make changes to the memory representation at runtime. When the server is stopped, it will overwrite the existing config.xml with the current representation of config.xml in memory. Therefore, any changes made to the config.xml file when the server is running will be lost.


For example, in the config.xml file, modify the module entry from:

<module name="org.apache.geronimo.configs/activemq-broker/2.1.4/car"/>

to

<module name="org.apache.geronimo.configs/activemq-broker/2.1.4/car">
<gbean name="ActiveMQ">
<attribute name="dataDirectory">var/activemq1/data</attribute>
<attribute name="brokerUri">var/activemq1/broker.xml</attribute>
</gbean>
</module>

This will result in the data directory becoming <GERONIMO_HOME>/var/activemq1/data.

Additional configuration of the message broker can be performed by using the ActiveMQ configuration file. The location of the configuration file can be specified by using the GBean attribute brokerUri, as shown. The complete path in this case will be <GERONIMO_HOME>/var/activemq1/broker.xml. This XML file provides a lot more configuration options than those provided by the ActiveMQ GBean.

The default port used is 61616. This is configured through the ActiveMQPort property in the config-substitutions.properties file.

config-substitutions.properties is a file that is present in the <GERONIMO_HOME>/var/config directory, and gives the values of variables that are used in the XML configuration files for Geronimo, as well as various services deployed on it.


Using the Administration Console

The Administration Console provides a JMS Server portlet that can be used to configure the Apache ActiveMQ embedded broker instance. This portlet lists the existing JMS listeners for ActiveMQ. You can start, stop, edit, and delete the existing JMS listeners. You can also add new listeners by clicking on the Add new ... listener links provided in the portlet. See Chapter 10, Administration, for more details on using this portlet to configure ActiveMQ.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset