Writing a custom Camel Processor
A custom Camel Processor is very easy to write and use within a route, and gives you full access to all parts of the exchange being processed. This is the ultimate functional element within Camel as you can create, and reuse, custom message processors that can do anything you can imagine doing with Java.
This recipe will show you how to create you own Camel Processor implementation that can be used, and shared, within your Camel integration routes.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.extend.processor
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with processor
.
How to do it...
In order to use a custom processor within your route, perform the following steps:
- Create your processor class that implements the
org.apache.camel.Processor
interface:import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.Processor; public class MyProcessor...