5.2. Configuring the Message Service

The BlazeDS MessageService has traditionally been configured by the inclusion of a messaging-config.xml file in the BlazeDS XML configuration. When using only Spring-managed message destinations, this config file can be left out completely as the inclusion of the message-broker tag in your Spring configuration will cause the MessageService to be configured with sensible defaults if none already exists at startup time. The end result is essentially equivalent to including the following minimal messaging-config.xml in your BlazeDS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"

        <adapter-definition id="actionscript" 

        <channel ref="my-polling-amf"/>

Note that this assumes that there is already an equivalent application-wide default-channels configuration. It is recommended that you set the desired service-specific channels (see example below) if not relying on an application-wide default setup. If no application-wide defaults exist, a best guess will be made by configuring the first available channel from the MessageBroker that uses an AMFEndpoint with polling enabled as the default for the MessageService.

If you wish to have more explicit control over the defaults that will be set on the MessageService, you can customize them via the message-service child element of the message-broker tag. For example:

	<flex:message-service default-adapter-id="my-default-messaging-adapter" 
		default-channels="my-polling-amf" />

If you have an existing messaging-config.xml for a legacy BlazeDS application, the MessageDestinationFactory will be able to work transparently with it, allowing you to gradually migrate to all Spring-managed messaging destinations.