}
});
// END SNIPPET: e3
// Camel template - a handy class for kicking off exchanges
// START SNIPPET: e4
CamelTemplate template = new CamelTemplate(context);
// END SNIPPET: e4
// Now everything is set up - lets start the context
context.start();
// now send some test text to a component - for this case a JMS Queue
// The text get converted to JMS messages - and sent to the Queue
// test.queue
// The file component is listening for messages from the Queue
// test.queue, consumes
// them and stores them to disk. The content of each file will be the
// test test we sent here.
// The listener on the file component gets notfied when new files are
// found ...
// that's it!
// START SNIPPET: e5
for (int i = 0; i < 10; i++) {
template.sendBody("test-jms:queue:test.queue", "Test Message: " + i);
}
// END SNIPPET: e5
Thread.sleep(1000);
context.stop();
}