Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Walk through an Example CodeThis mini-guide takes you through the source code of a simple example. Camel can be configured either by using Spring or directly in Java - which this example does. This example is available in the We start with creating a CamelContext - which is a container for Components, Routes etc: In normal use, an external system would be firing messages or events directly into Camel through one if its Components but we are going to use the ProducerTemplate which is a really easy way for testing your configuration: This will start all of the configured routing rules. So after starting the CamelContext, we can fire some objects into camel: What happens?From the ProducerTemplate - we send objects (in this case text) into the CamelContext to the Component test-jms:queue:test.queue. These text objects will be converted automatically into JMS Messages and posted to a JMS Queue named test.queue. When we set up the Route, we configured the FileComponent to listen off the test.queue. The File FileComponent will take messages off the Queue, and save them to a directory named test. Every message will be saved in a file that corresponds to its destination and message id. Finally, we configured our own listener in the Route - to take notifications from the FileComponent and print them out as text. That's it! If you have the time then use 5 more minutes to Walk through another example that demonstrates the Spring DSL (XML based) routing. |