public abstract class ProcessorReifier<T extends ProcessorDefinition<?>> extends AbstractReifier
| Modifier and Type | Field and Description |
|---|---|
protected T |
definition |
protected org.slf4j.Logger |
log |
camelContext, route| Constructor and Description |
|---|
ProcessorReifier(org.apache.camel.CamelContext camelContext,
T definition) |
ProcessorReifier(org.apache.camel.Route route,
T definition) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRoutes() |
static void |
clearReifiers() |
void |
configureChild(ProcessorDefinition<?> output)
Strategy for children to do any custom configuration
|
protected org.apache.camel.Processor |
createChildProcessor(boolean mandatory)
Creates the child processor (outputs) from the current definition
|
protected org.apache.camel.Processor |
createCompositeProcessor(List<org.apache.camel.Processor> list)
Creates a new instance of some kind of composite processor which defaults
to using a
Pipeline but derived classes could change the
behaviour |
protected org.apache.camel.Processor |
createOutputsProcessor()
Prefer to use {#link #createChildProcessor}.
|
protected org.apache.camel.Processor |
createOutputsProcessor(Collection<ProcessorDefinition<?>> outputs) |
abstract org.apache.camel.Processor |
createProcessor()
Override this in definition class and implement logic to create the
processor based on the definition model.
|
protected org.apache.camel.Processor |
createProcessor(ProcessorDefinition<?> output) |
ExecutorService |
getConfiguredExecutorService(String name,
ExecutorServiceAwareDefinition<?> definition,
boolean useDefault)
Will lookup and get the configured
ExecutorService from the given definition. |
ScheduledExecutorService |
getConfiguredScheduledExecutorService(String name,
ExecutorServiceAwareDefinition<?> definition,
boolean useDefault)
Will lookup and get the configured
ScheduledExecutorService from the given
definition. |
protected String |
getId(OptionalIdentifiedDefinition<?> def) |
boolean |
hasOutputs(List<ProcessorDefinition<?>> outputs,
boolean excludeAbstract)
Is there any outputs in the given list.
|
ExecutorService |
lookupExecutorServiceRef(String name,
Object source,
String executorServiceRef)
Will lookup in
Registry for a
ExecutorService registered with the given
executorServiceRef name. |
ScheduledExecutorService |
lookupScheduledExecutorServiceRef(String name,
Object source,
String executorServiceRef)
Will lookup in
Registry for a
ScheduledExecutorService registered with the given
executorServiceRef name. |
protected org.apache.camel.Channel |
makeProcessor()
Creates the processor and wraps it in any necessary interceptors and
error handlers
|
protected void |
preCreateProcessor()
Strategy to execute any custom logic before the
Processor is
created. |
static void |
registerReifier(Class<?> processorClass,
BiFunction<org.apache.camel.Route,ProcessorDefinition<?>,ProcessorReifier<? extends ProcessorDefinition<?>>> creator) |
static ProcessorReifier<? extends ProcessorDefinition<?>> |
reifier(org.apache.camel.Route route,
ProcessorDefinition<?> definition) |
boolean |
willCreateNewThreadPool(ExecutorServiceAwareDefinition<?> definition,
boolean useDefault)
Determines whether a new thread pool will be created or not.
|
protected org.apache.camel.Channel |
wrapChannel(org.apache.camel.Processor processor,
ProcessorDefinition<?> child) |
protected org.apache.camel.Channel |
wrapChannel(org.apache.camel.Processor processor,
ProcessorDefinition<?> child,
Boolean inheritErrorHandler) |
protected org.apache.camel.Processor |
wrapInErrorHandler(org.apache.camel.Processor output,
boolean longLived)
Wraps the given output in an error handler
|
org.apache.camel.Channel |
wrapProcessor(org.apache.camel.Processor processor)
Wraps the child processor in whatever necessary interceptors and error
handlers
|
asRef, createExpression, createExpression, createPredicate, createPredicate, findByType, findByTypeWithName, findSingleByType, getRegistry, lookup, lookupByName, lookupByNameAndType, mandatoryLookup, or, parse, parse, parseBoolean, parseBoolean, parseDuration, parseDuration, parseFloat, parseFloat, parseInt, parseInt, parseLong, parseLong, parseString, resolveEndpoint, unwrapprotected final org.slf4j.Logger log
protected final T extends ProcessorDefinition<?> definition
public ProcessorReifier(org.apache.camel.Route route, T definition)
public ProcessorReifier(org.apache.camel.CamelContext camelContext, T definition)
public static void registerReifier(Class<?> processorClass, BiFunction<org.apache.camel.Route,ProcessorDefinition<?>,ProcessorReifier<? extends ProcessorDefinition<?>>> creator)
public static void clearReifiers()
public static ProcessorReifier<? extends ProcessorDefinition<?>> reifier(org.apache.camel.Route route, ProcessorDefinition<?> definition)
public boolean willCreateNewThreadPool(ExecutorServiceAwareDefinition<?> definition, boolean useDefault)
definition - the node definition which may leverage executor
service.useDefault - whether to fallback and use a default thread pool, if
no explicit configuredgetConfiguredExecutorService(String, ExecutorServiceAwareDefinition, boolean)public ExecutorService getConfiguredExecutorService(String name, ExecutorServiceAwareDefinition<?> definition, boolean useDefault) throws IllegalArgumentException
ExecutorService from the given definition.
This method will lookup for configured thread pool in the following order
Registry if foundThreadPoolProfile(s).ExecutorServiceAwareDefinition should use this helper
method to ensure they support configured executor services in the same
coherent way.name - name which is appended to the thread name, when the
ExecutorService is created based
on a ThreadPoolProfile.definition - the node definition which may leverage executor
service.useDefault - whether to fallback and use a default thread pool, if
no explicit configuredIllegalArgumentException - is thrown if lookup of executor service
in Registry was not foundpublic ScheduledExecutorService getConfiguredScheduledExecutorService(String name, ExecutorServiceAwareDefinition<?> definition, boolean useDefault) throws IllegalArgumentException
ScheduledExecutorService from the given
definition.
This method will lookup for configured thread pool in the following order
Registry if foundThreadPoolProfile(s).ExecutorServiceAwareDefinition should use this helper
method to ensure they support configured executor services in the same
coherent way.name - name which is appended to the thread name, when the
ExecutorService is created based
on a ThreadPoolProfile.definition - the node definition which may leverage executor
service.useDefault - whether to fallback and use a default thread pool, if
no explicit configuredIllegalArgumentException - is thrown if the found instance is not a
ScheduledExecutorService type, or lookup of executor service
in Registry was not foundpublic ScheduledExecutorService lookupScheduledExecutorServiceRef(String name, Object source, String executorServiceRef)
Registry for a
ScheduledExecutorService registered with the given
executorServiceRef name.
This method will lookup for configured thread pool in the following order
Registry if foundThreadPoolProfile(s).name - name which is appended to the thread name, when the
ExecutorService is created based
on a ThreadPoolProfile.source - the source to use the thread poolexecutorServiceRef - reference name of the thread poolpublic ExecutorService lookupExecutorServiceRef(String name, Object source, String executorServiceRef)
Registry for a
ExecutorService registered with the given
executorServiceRef name.
This method will lookup for configured thread pool in the following order
Registry if foundThreadPoolProfile(s).name - name which is appended to the thread name, when the
ExecutorService is created based
on a ThreadPoolProfile.source - the source to use the thread poolexecutorServiceRef - reference name of the thread poolpublic boolean hasOutputs(List<ProcessorDefinition<?>> outputs, boolean excludeAbstract)
outputs - the outputsexcludeAbstract - whether or not to exclude abstract outputs (e.g.
skip onException etc.)public abstract org.apache.camel.Processor createProcessor() throws Exception
Exceptionprotected org.apache.camel.Processor createOutputsProcessor() throws Exception
Exceptionprotected org.apache.camel.Processor createChildProcessor(boolean mandatory) throws Exception
mandatory - whether or not children is mandatory (ie the definition
should have outputs)Exception - is thrown if error creating the child or if it was
mandatory and there was no output defined on definitionpublic org.apache.camel.Channel wrapProcessor(org.apache.camel.Processor processor) throws Exception
Exceptionprotected org.apache.camel.Channel wrapChannel(org.apache.camel.Processor processor, ProcessorDefinition<?> child) throws Exception
Exceptionprotected org.apache.camel.Channel wrapChannel(org.apache.camel.Processor processor, ProcessorDefinition<?> child, Boolean inheritErrorHandler) throws Exception
Exceptionprotected org.apache.camel.Processor wrapInErrorHandler(org.apache.camel.Processor output, boolean longLived) throws Exception
output - the outputlongLived - if the processor is longLived or notException - can be thrown if failed to create error handler builderprotected org.apache.camel.Processor createCompositeProcessor(List<org.apache.camel.Processor> list) throws Exception
Pipeline but derived classes could change the
behaviourExceptionprotected org.apache.camel.Processor createOutputsProcessor(Collection<ProcessorDefinition<?>> outputs) throws Exception
Exceptionprotected org.apache.camel.Processor createProcessor(ProcessorDefinition<?> output) throws Exception
Exceptionprotected org.apache.camel.Channel makeProcessor() throws Exception
Exceptionprotected void preCreateProcessor()
Processor is
created.public void configureChild(ProcessorDefinition<?> output)
output - the child to be added as output to thisprotected String getId(OptionalIdentifiedDefinition<?> def)
Apache Camel