...
Here is a custom factory which will alter the processor definitions.
Wiki Markup |
---|
{snippet:id=e3|lang=java|title=MyFactory|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java} |
The route is as follows
Wiki Markup |
---|
{snippet:id=e2|lang=java|title=Route|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java} |
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.
...
In Java DSL all you need to do is to configure the custom factory on the CamelContext as shown:
Wiki Markup |
---|
{snippet:id=e1|lang=java|title=Configuring ProcessorFactory in Java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.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.
Wiki Markup |
---|
{snippet:id=e1|lang=xml|title=Configuring ProcessorFactory in Spring|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/CustomProcessorFactoryTest.xml} |