## XML Configuration

The recommended way to configure FUSE Message Broker is by using an XBean XML configuration file. XBean is an extension of the Spring Framework that has allowed the developers of Apache ActiveMQ to develop a syntax that is less verbose and yet more expressive than basic Spring configuration.

By default, FUSE Message Broker uses the `activemq.xml` configuration file stored in the ``InstallDir`/conf` directory.

### Specifying an alternative configuration file

You can specify an alternative XML configuration file when running FUSE Message Broker by using the xbean:file command line option, as follows:

`activemq xbean:file:`PathToXmlConfigFile``

For example:

`activemq xbean:file:C:/iona/fuse-message-broker-5.1.0.0/conf/activemq.xml`

### Configuration file format

The broker XML configuration file is comprised of a root `beans` element followed by a nested `broker` element.

Example 1.1. Example activemq.xml

    <beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:amq="http://activemq.org/config/1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
      http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

    <!-- Allows us to use system properties as variables in this configuration file -->
      <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

      <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" dataDirectory="${activemq.base}/data"

      <!-- The transport connectors ActiveMQ will listen to -->
        <transportConnectors>
           <transportConnector name="openwire" uri="tcp://localhost:61616"/>
           <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
           <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
           <transportConnector name="xmpp"    uri="xmpp://localhost:61222"/>
        </transportConnectors>

        <!-- The store and forward broker networks ActiveMQ will listen to -->
        <networkConnectors>
        <!-- by default just auto discover the other brokers -->
        <networkConnector name="default-nc" uri="multicast://default"/>
        <networkConnector name="host1 and host2" uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
        </networkConnectors>>

      </broker>
    </beans>

Full details of elements and attributes that you may find in the configuration file can be found in the XML Configuration Reference>. The following sections detail the most important tags.

### The `broker` element

The `broker` element identifies and configures an instance of a broker. Specifying more than one `broker` element results in multiple broker instances running in the same virtual machine.

`brokerName`

  Specifies a unique name for the broker instance. Be sure not to use special characters, such as underscores, as they are converted to URIs which do not allow things like underscores in them.

`dataDirectory`

  Specifies the directory where data files for the JDBC and Journal persistence adaptors are stored.

### Transport connectors

The `transportConnectors` element contains one or more nested `transportConnector` elements, each of which specifies an IP address and port number on which the broker listens and accepts network connection requests from clients.

The `transportConnector` element takes the following attributes:

`uri`

  Specifies the URI for this transport connector. For example, `tcp://localhost:61616`. Required.

`discoveryURI`

  Enables a discovery agent fort this transport connector. The broker will listen for discovery advertisements from other brokers using this URI.

`name`

  The name assigned to the transportConnector.

### Network connectors

The `networkConnectors` element contains one or more nested `networkConnector` elements, each of which specifies an IP address and port number on which the broker creates connections to other brokers. The following attributes are required.

`name`

  The name of the network connector.

`uri`

  The URI for this netwwork connector. You must use a static, rendezvous, or multicast URI

### Configuring persistence

You can configure a number of message persistence implementations using the persistenceAdapter element. See Using FUSE™ Message Broker's Persistence Features for details.

Example 1.2. Configuring Persistence

    <persistenceAdapter>
      <journaledJDBC journalLogFiles="5" dataDirectory="${activemq.base}/activemq-data" dataSource="#postgres-ds"/>
    </persistenceAdapter>

### Startup destintations

Typically in FUSE Message Broker, destinations are created on demand. However, you can configure which destinations are available when the broker starts up using the `destinations` element.

Example 1.3. Configuring Startup Destinations

    <destinations>
      <queue physicalName="FOO.BAR" />
      <topic physicalName="SOME.TOPIC" />
    </destinations>

The `name` and `physicalName` attributes should match the corresponding names in the client's JNDI context.