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 asciidoc in the repository:


Available as of Camel 2.4

There is a org.apache.camel.spi.ProcessorFactory which allows you to use a custom factory for creating Processor based on the Camel routes.
The factory can also be used for manipulating the definitions before the Processors is created. For example you can use it to alter options, or even add new outputs to the routes, before the routes is actually created.


Here is a custom factory which will alter the processor definitions.


The unit test and route is as follows:

Unit test and route

Now the idea is that the setBody processors has been changed by the factory to set a different body.
Also the Splitter has one additional output where we send the splitted message to mock:extra endpoint.

Notice we just return null which instructs Camel to use its default implementation to create the Processor. After all we just wanted to manipulate the definition. However if you do return a Processor then Camel use the returned processor.

Java DSL

In Java DSL all you need to do is to configure the custom factory on the CamelContext using the setProcessorFactory method:

Configuring ProcessorFactory in Java

Spring XML

In Spring XML all you have to do is just to declare a <bean> tag with the custom factory, and Camel will automatic lookup it up and use it.

Configuring ProcessorFactory in Spring
© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram