Versions Compared

Key

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

...

There is more than one way of adding a Component to the CamelContext - explicitly . You can add components implicitly - when we set up the routing - as we do here when we add the JMS Componentfor the FileComponent:

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

or implicitly - when we set up the routing (explicitly - as we do here for the FileComponentwhen we add the JMS Component:

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

The above works with any JMS provider. If we know we are using ActiveMQ we can use an even simpler form using the activeMQComponent() method while specifying the brokerURL used to connect to ActiveMQ

Wiki Markup
{snippet:id=example|lang=java|url=activemq/camel/trunk/components/camel-activemq/src/test/java/org/apache/camel/component/activemq/ActiveMQRouteTest.java}

In normal use, an external system would be firing messages or events into directly into Camel through one if its Components or Containers but we are going to use the CamelClient CamelTemplate which is a really nice an easy way for testing your configuration:

...