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: A custom ProcessorFactory should extend the default implementation org.apache.camel.processor.DefaultProcessorFactory and in the overridden methods, super should be called to let the default implementation create the processor when custom processors is not created.

    • Method Detail

      • createChildProcessor

        Processor createChildProcessor​(Route route,
                                       NamedNode 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:
        route - 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​(Route route,
                                  NamedNode definition)
                           throws Exception
        Creates the processor.
        Parameters:
        route - 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
      • createProcessor

        Processor createProcessor​(CamelContext camelContext,
                                  String definitionName,
                                  Object[] args)
                           throws Exception
        Creates a processor by the name of the definition. This should only be used in some special situations where the processor is used internally by Camel itself and some component such as camel-cloud, camel-seda.
        Parameters:
        camelContext - the camel context
        definitionName - the name of the definition that represents the processor
        args - arguments for creating the processor (optimized to use fixed order of parameters)
        Returns:
        the created processor, or null if this situation is not yet implemented.
        Throws:
        Exception - can be thrown if error creating the processor