Versions Compared

Key

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

...

Wiki Markup
{snippet:id=e4|lang=java|url=activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}

From Camel 1.4.0 on the ProducerTemplate must be retrieved from the CamelContext. You can then use it the same way as before.

Code Block

ProducerTemplate<JmsExchange> camelTemplate = camelContext.createProducerTemplate();

Next you must start the camel context. If you are using Spring to configure the camel context this is automatically done for you; though if you are using a pure Java approach then you just need to call the start() method

...

Finally, we configured our own listener in the Route - to take notifications from the FileComponent and print them out as text.

That's it!

Note
titleCamel 1.4.0 change

In Camel 1.4.0, CamelTemplate has been marked as @deprecated. ProducerTemplate should be used instead and its created from the CamelContext itself.

Code Block

ProducerTemplate template = context.createProducerTemplate();