...
Camel supports the Message Translator from the EIP patterns by using an artibrary Processor in the routing logic or by using a bean in the Bean Integration to perform the transformation. You can also use a Data Format to marshal and unmarshal messages in different encodings.
Using the Fluent Builders
You can transform a message using Camel's Bean Integration to call any method on a bean in your Registry such as your Spring XML configuration file as follows
Code Block |
---|
from("activemq:SomeQueue").
beanRef("myTransformerBean").
to("mqseries:AnotherQueue");
|
Where the "myTransformerBean" would be defined in a Spring XML file or defined in JNDI etc.
or you can add your own explicit Processor to do the transformation
Wiki Markup |
---|
{snippet:id=example|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformViaDSLTestTransformTest.java} |
or you can add your own Processoruse the DSL to explicitly configure the transformation
Wiki Markup |
---|
{snippet:id=example|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformTestTransformViaDSLTest.java} |
Or you could use Camel's Bean Integration by calling a named bean from your Registry such as your Spring XML configuration file as follows
Code Block |
---|
from("activemq:SomeQueue").
beanRef("myTransformerBean").
to("mqseries:AnotherQueue");
|
Where the "myTransformerBean" would be defined in a Spring XML file or defined in JNDI etc.
You can also use Templating to consume a message from one destination, transform it with something like Velocity or XQuery and then send it on to another destination. For example using InOnly (one way messaging)
...