Java Reference
In-Depth Information
Message transformation can also be accomplished with the recent addition of the Smooks
transformation engine. It is a Java framework for performing a wide range of data transform-
ations, including XML to EDI, CSV, Java, and more. You can process large messages and can
split, transform, and route message fragments to JMS, File, or database destinations.
Mule is nonintrusive, meaning that classes that you implement to perform some function don't
have to import any Mule-specific libraries. Once you have written a component that does
some work for you, you need to tell Mule about it. Similar to Spring, Mule configuration is
done using XML files that describe the inbound and outbound routes for components. The
Mule configuration file is shown in Example 14-1 .
Example14-1.mule-config.xml
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.0"
xsi:schemaLocation="http://www.mulesource.org/schema/mule/core/2.0
http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
http://www.mulesource.org/schema/mule/stdio/2.0
http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd">
<stdio:connector name="inConnector" promptMessage="Your Message: "/>
<model name="HelloWorld">
<service name="HelloComponent">
<inbound>
<stdio:inbound-endpoint system="IN"
connector-ref="inConnector"/>
</inbound>
<component class="com.soacookbook.HelloComponent"/>
</service>
</model>
</mule>
This is about as simple as a Mule configuration file can get. The standard I/O connector
( stdio ) is used here to accept input from a console, as indicated by the <connector> element.
The connector declares that it uses System In, and that will be used as a router for the inbound
message. HelloComponent is a class that you could write to log or echo the statement made by
the end user; that class is indicated with the <component> element. The <service> element
combines the inbound message with the component class that does something with it. Mule
can attempt to determine the appropriate method to call using reflection based on the payload
of the message.
Search WWH ::




Custom Search