concept Exchange in category camel

appears as: Exchge, The Exchge, Exchge, An Exchge, n Exchange
Camel in Action

This is an excerpt from Manning's book Camel in Action.

Processor is a low-level API in which you work directly on the Camel Exchange instance. It gives you full access to all of Camel’s moving parts from the CamelContext, which you can obtain from the Exchange by using the getContext method.

Listing 9.1 A first unit test using the Camel Test Kit
public class FirstTest extends CamelTestSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception {     #1 from("file://target/inbox") .to("file://target/outbox"); } }; } @Test public void testMoveFile() throws Exception { template.sendBodyAndHeader("file://target/inbox", "Hello World", Exchange.FILE_NAME, "hello.txt");     #2 Thread.sleep(2000); File target = new File("target/outbox/hello.txt"); assertTrue("File not moved", target.exists());     #3 } } #1 Defines route to test #2 Creates hello.txt file #3 Verifies file is moved

Figure 12.14 An Exchange has one UnitOfWork, which in turn has from zero to many Synchronizations.

c12_14.png

In a nutshell, the Simple expression language evaluates an expression on the current instance of Exchange that’s under processing. The Simple language can be used for both expressions and predicates, which makes it perfect to use in your Camel routes.

Camel in Action

This is an excerpt from Manning's book Camel in Action.

We’ll start by looking at Message to understand how data is modeled and carried in Camel. Then we’ll look at how a “conversation” is modeled in Camel by the Exchange.

Figure 9.13. An Exchange has one UnitOfWork, which in turn has from zero to many Synchronizations.

In a nutshell, the Simple expression language evaluates an expression on the current instance of Exchange that is under processing. The Simple language can be used for both expressions and predicates, which makes it a perfect match to be used in your Camel routes.