camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilya S <>
Subject InterceptionStrategy: target vs nextTarget (camel 2.3.0)
Date Wed, 08 Sep 2010 18:08:51 GMT
I'm implementing a global InterceptStrategy that is supposed to wrap only
some of the processors (in particular I'm interested in the processors that
implement particular interface).

When debugging my strategy, I noticed that in most cases the *target *object
does not contain the actual object I'm interested in (e.g. more often I get
TraceInterceptor that wraps the real object),while *nextTarget *contains the
processor that I actually want to wrap.
>From the docs I can see the following:
     * @param target        the processor to be wrapped
     * @param nextTarget    the next processor to be routed to

Could someone clarify the meaning of nextTarget?

In my implementation I had to do the following (based on the source of some
interception strategies):

        // prefer next target over target as next target is the real target
        Processor interceptedProcessor = nextTarget != null ? nextTarget :

        // Intercept Dharma Process

            // Wrap the interceptedProcessor  here, and return it
        return target;

Does this code make sense, or am I doing something weird here? The code
seems to perform what I need, though, it seems to me that the intention of
this interface is to wrap the target and not the nextTarget.

Thank you for your help.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message