Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Type

Number of beans

Description

PackageScanClassResolver

0..1

To use a 3rd party package scan resolver. More details at XXXX Pluggable Class Resolver.

ClassResolver

0..1

To use a 3rd party class resolver. More details at XXXX Pluggable Class Resolvers.

FactoryFinderResolver

0..1

To use a 3rd party factory finder.

LifecycleStrategy

0..1

To use a 3rd party lifecycle strategy. By default Camel uses a JMX aware that does JMX instrumentation.

Registry

0..1

To use a 3rd party bean registry. By default Camel will use Spring ApplicationContext as registry.

Debugger

0..1

To use a Debugger usually for tooling.

Tracer

0..1

To use a 3rd party Tracer.

TraceFormatter

0..1

To use a bean that has the tracing options configured.

HandleFault

0..1

To use a 3rd part fault handler to handle FAULT messages.

Delayer

0..1

To use a 3rd part Delayer.

And the following options have support for any number of beans defined.

Type

Number of beans

Description

InterceptStrategy

0..n

To use your own Intercept that intercepts every processing steps in all routes in the CamelContext. For instance you can use this to do an AOP like performance timer interceptor.

...

Using container wide interceptors

Imagine that you have multiple CamelContext and you want to configure that they all use the same container wide interceptor. How do we do that? Well we can leverage the fact that Camel can auto detect and use custom interceptors. So what we simply do is to define our interceptor in the spring xml file. The sample below does this and also define 2 camel contexts. The sample is based on unit test.

...

Wiki Markup
{snippet:id=e1|lang=java|title=InterceptorStrategy|url=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/ContainerWideInterceptorTestContainerWideInterceptor.java}

When Camel boots up it logs at INFO level the container wide interceptors it have found:

Code Block

INFO  CamelContextFactoryBean        - Using custom intercept strategy with id: myInterceptor and implementation:org.apache.camel.spring.interceptor.ContainerWideInterceptor@b84c44

Notice: If we have more than 1 container wide interceptor, we can just define them as spring bean. Camel will find and use them.

See Also