Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
{snippet:id=example|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformTest.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

...

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)

Code Block

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.

Code Block

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

...