About Mule Configuration
Following is an introduction to configuring Mule ESB via the Spring XML file. For details on this file, see About the XML Configuration File.
Overview of a Mule Configuration
A Mule ESB configuration file is a tree, as shown in the following illustration:
Each of these elements provides access to configuration object within Mule:
-
Custom Message Processors - Observe a message, or modify either a message or the message flow. Examples include transformers and filters.
-
Flows - Use message processors to define message flow between a source and a target.
-
Mule Global Configuration - Global settings, such as the default transaction time-out, that apply to the entire Mule configuration
-
Connectors - Non-default configuration of any transports used
-
Endpoints - Define the channel and address or path where messages are sent or received. You can define them globally and use them in multiple flows.
-
Transformers - Convert data from one format to another. You can define them globally and use them in multiple flows.
-
Filters - Filter out the messages that don’t match specific criteria. You can define them globally and use them in multiple flows.
Following is an example of a simple Mule configuration file:
Simple Mule Configuration |
---|
|
Other, more advanced things you may configure at this level:
-
Security Manager - Authenticates requests based on one or more security providers
-
Agents - Agents are typically used for cross-cutting concerns such as logging or management
-
Notifications - Allow you to be notified upon certain lifecycle events
-
Transaction Management - Mule transactions are configured on inbound endpoints, where an endpoint can be configured to start a new transaction or join an existing one.
-
Properties - Property placeholders, message properties, and system properties.
Global Configuration Settings
You can configure global configuration settings such as the default transaction timeout and default threading profile in the <configuration>
element. For example:
<mule>
...
<configuration defaultTransactionTimeout="31337">
<default-threading-profile poolExhaustedAction="RUN"/>
...
</configuration>
For a list of the available global configuration settings, see Global Settings Configuration Reference.
Accessing the Configuration Programmatically
All Mule configuration is accessible from a single object: org.mule.api.config.MuleConfiguration.
Configurations in a MuleConfiguration are set when a MuleContext
is created. The object becomes immutable after it is started and can be accessed using the following:
// implement MuleContextAware to have the reference injected
MuleConfiguration configuration = context.getConfiguration();