Interface InterceptStrategy
public interface InterceptStrategy
Strategy that wraps the
to easily return an
Processors in a route with interceptors, for cross-cutting concerns such as gathering
performance statistics at the processor level.
Camel invokes wrapProcessorInInterceptors(CamelContext, NamedNode, Processor, Processor) for each processor while building a route, giving the strategy the
chance to return a wrapping processor (or the original). Registered strategies are applied to every interceptable
processor; a processor can opt out by implementing InterceptableProcessor.
It is strongly advised to return an AsyncProcessor as the wrapper, which ensures the
interceptor works well with the asynchronous routing engine. You can use
invalid reference
org.apache.camel.support.processor.DelegateAsyncProcessor
AsyncProcessor and override
AsyncProcessor.process(org.apache.camel.Exchange, org.apache.camel.AsyncCallback) to
implement your interceptor logic, then invoke the super method to continue routing.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionwrapProcessorInInterceptors(CamelContext context, NamedNode definition, Processor target, @Nullable Processor nextTarget) Give implementor an opportunity to wrap the target processor in a route.
-
Method Details
-
wrapProcessorInInterceptors
Processor wrapProcessorInInterceptors(CamelContext context, NamedNode definition, Processor target, @Nullable 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
-