Transforming using a Simple Expression
When you want to transform a message in a relatively straightforward way, you use Camel's transform
statement along with one of the Expression Languages provided by the framework. For example, Camel's Simple Expression Language provides you with a quick, inline mechanism for straightforward transformations.
This recipe will show you how to use Camel's Simple Expression Language to transform the message body.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.transformation.simple
package. Spring XML files are located under src/main/resources/META-INF/spring
and are prefixed with simple
.
How to do it...
In a Camel route, use a transform
DSL statement containing the Expression Language code to do your transformation.
In the XML DSL, this is written as follows:
<route> <from uri="direct:start"/> <transform> <simple>Hello ${body}</simple> </transform> </route...