2.6.  Configure the Virtual Hosts via virtualhosts.xml

2.6.1.  virtualhosts.xml Overview

This configuration file contains details of all queues and topics, and associated properties, to be created on broker startup. These details are configured on a per virtual host basis.

Note that if you do not add details of a queue or topic you intend to use to this file, you must first create a consumer on a queue/topic before you can publish to it using Qpid.

Thus most application deployments need a virtualhosts.xml file with at least some minimal detail.  XML Format with Comments

The virtualhosts.xml which currently ships as part of the Qpid distribution is really targeted at development use, and supports various artifacts commonly used by the Qpid development team.

As a result, it is reasonably complex. In the example XML below, I have tried to simplify one example virtual host setup which is possibly more useful for new users of Qpid or development teams looking to simply make use of the Qpid broker in their deployment.

I have also added some inline comments on each section, which should give some extra information on the purpose of the various elements.

    <!-- Sets the default virtual host for connections which do not specify a vh -->
    <!-- Define a virtual host and all it's config -->
            <!-- Define the types of additional AMQP exchange available for this vh -->   
            <!-- Always get amq.direct (for queues) and amq.topic (for topics) by default -->     
                <!-- Example of declaring an additional exchanges type for developer use only -->
            <!-- Define the set of queues to be created at broker startup -->
                <!-- The properties configured here will be applied as defaults to all -->
                <!-- queues subsequently defined unless explicitly overridden -->
                <!-- Set threshold values for queue monitor alerting to log --> 
                <maximumQueueDepth>4235264</maximumQueueDepth>  <!-- 4Mb -->
                <maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
                <maximumMessageAge>600000</maximumMessageAge>  <!-- 10 mins -->

                <!-- Define a queue with all default settings -->   
                <!-- Example definitions of queues with overriden settings -->
</virtualhosts>  Using your own virtualhosts.xml

Note that the config.xml file shipped as an example (or developer default) in the Qpid distribution contains an element which defines the path to the virtualhosts.xml.

When using your own virtualhosts.xml you must edit this path to point at the location of your file.