Package org.apache.camel.spi
Interface InterceptStrategy
-
public interface InterceptStrategy
The purpose of this interface is to allow an implementation to wrap processors in a route with interceptors. For example, a possible usecase is to gather performance statistics at the processor's level. Its strongly adviced to use anAsyncProcessor
as the returned wrappedProcessor
which ensures the interceptor works well with the asynchronous routing engine. You can use theorg.apache.camel.support.processor.DelegateAsyncProcessor
to easily return anAsyncProcessor
and override theAsyncProcessor.process(org.apache.camel.Exchange, org.apache.camel.AsyncCallback)
to implement your interceptor logic. And just invoke the super method to continue routing.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Processor
wrapProcessorInInterceptors(CamelContext context, NamedNode definition, Processor target, Processor nextTarget)
Give implementor an opportunity to wrap the target processor in a route.
-
-
-
Method Detail
-
wrapProcessorInInterceptors
Processor wrapProcessorInInterceptors(CamelContext context, NamedNode definition, Processor target, Processor nextTarget) throws Exception
Give implementor an opportunity to wrap the target processor in a route. Important: See the class javadoc for advice on letting interceptor be compatible with the asynchronous routing engine.- Parameters:
context
- Camel contextdefinition
- the model this interceptor representstarget
- the processor to be wrappednextTarget
- the next processor to be routed to- Returns:
- processor wrapped with an interceptor or not wrapped.
- Throws:
Exception
- can be thrown
-
-