You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Message Translator

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

Error formatting macro: snippet: java.lang.NullPointerException

or you can add your own Processor

Error formatting macro: snippet: java.lang.NullPointerException

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

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 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)

from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm").
  to("activemq:Another.Queue");

If you want to use InOut (request-reply) semantics to process requests on the My.Queue queue on ActiveMQ with a template generated response, then sending responses back to the JMSReplyTo Destination you could use this.

from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm");

For further examples of this pattern in use you could look at one of the JUnit tests

Using This Pattern

If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.

  • No labels