You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for Channel Interceptors to be applied "globally" and based on name patterns [INT-789] #4796
Channels could maybe support an "abstract" boolean attribute and then others use "parent" (to inherit interceptors, etc). This would be consistent with Spring beans in general and also Spring Batch "step" elements.
We might want to support that style also (should be easy enough by creating a stack impl that is itself a single ChannelInterceptor), but I was thinking about something more like this:
The 'order' attribute signifies where this interceptor chain will be added to the channel if it already has interceptors defined locally (e.g., see 'bar' channel above). Positive value will ensure that global interceptors are added AFTER the existing interceptors. Negative value would add them before.
The reason why we use number instead of enumeration 'BEFORE' and 'AFTER' is because we need to manage the order of those global interceptor between one another.
This issue is READY TO RESOLVE pending review.
Documentation must be added before resolving it!!!
the fact that the <channel-interceptor/> is a top-level element (instead of a sub-element in a channel) should be enough to signify that it's "global".
the "channel-name-pattern" can just be "pattern" since we know it's applying to channels (that's also what the secured-channels configuration has)
if "order" is provided as an attribute, we can wrap the interceptor bean in OrderedChannelInterceptor (a delegate that also implements Ordered).
we should just set all interceptors on the AbstractMessageChannel instance and let it handle the sorting internally (we would need to define an addInterceptor method for the BPP to invoke)
I think I am OK with not defining an explicit interceptor-chain and simply have an order attribute on individual interceptors. This will result in natural chaining anyway, so should be fine and easy to understand.
Although even with this scenario we could still have individual interceptors defined within the channels, which means we still have to maintain order semantics for global interceptors as BEFORE < 0 (e.g., order="-1") and AFTER (e.g., order="6") allowing global interceptors to be applied before and after local interceptors.
THoughts?
Activity
spring-operator commentedon Sep 25, 2009
Mark Fisher commented
Another somewhat related idea:
Channels could maybe support an "abstract" boolean attribute and then others use "parent" (to inherit interceptors, etc). This would be consistent with Spring beans in general and also Spring Batch "step" elements.
spring-operator commentedon Mar 4, 2010
Oleg Zhurakousky commented
Did you mean something like this (besides the abstract channels idea from the previous comment):
spring-operator commentedon Mar 4, 2010
Mark Fisher commented
We might want to support that style also (should be easy enough by creating a stack impl that is itself a single ChannelInterceptor), but I was thinking about something more like this:
spring-operator commentedon Mar 26, 2010
Oleg Zhurakousky commented
Support for global channel interceptors was added.
Example (global interceptors below will be added to both channels):
The 'order' attribute signifies where this interceptor chain will be added to the channel if it already has interceptors defined locally (e.g., see 'bar' channel above). Positive value will ensure that global interceptors are added AFTER the existing interceptors. Negative value would add them before.
The reason why we use number instead of enumeration 'BEFORE' and 'AFTER' is because we need to manage the order of those global interceptor between one another.
This issue is READY TO RESOLVE pending review.
Documentation must be added before resolving it!!!
spring-operator commentedon May 7, 2010
Mark Fisher commented
Add the docs if you get a chance, and I'll review in the morning.
spring-operator commentedon May 7, 2010
Oleg Zhurakousky commented
Documentation was added. See Global Channel Interceptors Configuration section
spring-operator commentedon Jun 15, 2010
Oleg Zhurakousky commented
Still looks a bit confusing, would like to simplify it further
spring-operator commentedon Jun 15, 2010
Oleg Zhurakousky commented
One of the suggestion is to eliminate the explicit chaining and have global interceptor defined as top level elements with order attribute.
A few notes:
I think I am OK with not defining an explicit interceptor-chain and simply have an order attribute on individual interceptors. This will result in natural chaining anyway, so should be fine and easy to understand.
Although even with this scenario we could still have individual interceptors defined within the channels, which means we still have to maintain order semantics for global interceptors as BEFORE < 0 (e.g., order="-1") and AFTER (e.g., order="6") allowing global interceptors to be applied before and after local interceptors.
THoughts?
spring-operator commentedon Jun 17, 2010
Oleg Zhurakousky commented
Global interceptors can now be applied as described in the last comment