org.apache.camel.spi
Interface ProcessorFactory


public interface ProcessorFactory

A factory to create Processor based on the definition.

This allows you to implement a custom factory in which you can control the creation of the processors. It also allows you to manipulate the definitions for example to configure or change options. Its also possible to add new steps in the route by adding outputs to definitions.

Important: By returning null from the create methods you fallback to let the default implementation in Camel create the Processor. You want to do this if you only want to manipulate the definitions.

Version:

Method Summary
 Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition<?> definition, boolean mandatory)
          Creates the child processor.
 Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> definition)
          Creates the processor.
 

Method Detail

createChildProcessor

Processor createChildProcessor(RouteContext routeContext,
                               ProcessorDefinition<?> definition,
                               boolean mandatory)
                               throws Exception
Creates the child processor.

The child processor is an output from the given definition, for example the sub route in a splitter EIP.

Parameters:
routeContext - the route context
definition - the definition which represents the processor
mandatory - whether or not the child is mandatory
Returns:
the created processor, or null to let the default implementation in Camel create the processor.
Throws:
Exception - can be thrown if error creating the processor

createProcessor

Processor createProcessor(RouteContext routeContext,
                          ProcessorDefinition<?> definition)
                          throws Exception
Creates the processor.

Parameters:
routeContext - the route context
definition - the definition which represents the processor
Returns:
the created processor, or null to let the default implementation in Camel create the processor.
Throws:
Exception - can be thrown if error creating the processor


Apache CAMEL