concept Java code in category camel

This is an excerpt from Manning's book Camel in Action.
Routes in Camel are defined in such a way that they flow when read. This route can be read like this: consume messages
from filelocationdata/inboxwith thenoopoption set, and sendto filelocationdata/outbox. Thenoopoption tells Camel to leave the source file as is. If you didn’t use this option, the file would be moved. Most people who’ve never seen Camel before will be able to understand what this route does. You may also want to note that, excluding the boilerplate code, you created a file-polling route in just two lines of Java code ❶.
Camel provides great freedom in data mapping because it allows you to use Java code. You aren’t limited to using a particular data-mapping tool that may at first seem elegant but turns out to make things impossible.
Camel also allows you to use custom expressions. This is useful when you need to be in full control and have Java code at your fingertips. For example, the previous example could’ve been implemented as follows:
from("direct:start") .transform(new Expression() { public <T> T evaluate(Exchange exchange, Class<T> type) { String body = exchange.getIn().getBody(String.class); body = body.replaceAll("\n", "<br/>"); body = "<body>" + body + "</body>"; return (T) body; } }) .to("mock:result");As you can see, this code uses an inlined Camel
Expressionthat allows you to use Java code in itsevaluatemethod. This follows the same principle as the CamelProcessoryou saw before.