INT-3332 GlobalChannelInterceptorBeanPostProcessor

Implicit channel declaration for items downstream
of a `ChannelInterceptor` were not created.

The `BPP` eagerly fetched the interceptors during its
own creation; this caused the context initialization to fail
because the channel initializer hasn't run yet.

Defer creation of the interceptor beans until they are
actually needed.

Also, when using `@Configuration`, the channelInitializer
is no longer the first bean in the bean factory.

INT-3332 Use SmartLifeCycle to Apply Interceptors

Instead of using a bean post processor, the interceptor
processor now performs the channel interception when beans
in phase Integer.MIN_VALUE are started - after all beans
have been instantiated.

Polishing
This commit is contained in:
Gary Russell
2014-03-19 15:10:34 +02:00
committed by Artem Bilan
parent 23a26ca38e
commit b92134fae7
12 changed files with 363 additions and 73 deletions

View File

@@ -837,6 +837,17 @@ payload to an Integer.
best of both worlds: 1) the sending of a JMS Message can occur within the transaction while
2) it is still a "fire-and-forget" action thereby preventing any noticeable delay in the main message flow.
</para>
<important>
Starting with <emphasis>version 4.0</emphasis>, it is important to avoid circular references when an
interceptor (such as <classname>WireTap</classname>) references a channel itself. You need to exclude
such channels from those being intercepted by the current interceptor. This can be done with appropriate
<code>patterns</code> or programmatically. If you have a custom <interfacename>ChannelInterceptor</interfacename>
that references a <code>channel</code>, consider implementing <interfacename>VetoCapableInterceptor</interfacename>.
That way, the framework will ask the interceptor if it's OK to intercept each channel that is a candidate based
on the pattern. You can also add runtime protection in the interceptor methods that ensures that the channel is
not one that is referenced by the interceptor. The <classname>WireTap</classname> uses both of these
techniques.
</important>
</section>
<section id="channel-global-wiretap">
<title>Global Wire Tap Configuration</title>

View File

@@ -434,7 +434,7 @@ rt.setConnectionFactory(redisConnectionFactory);]]></programlisting>
<int:queue message-store="redisMessageStore"/>
<int:channel>]]></programlisting>
<para>
The keys are used to store the data have the form <code>&lt;storeBeanName&gt;:&lt;channelId&gt;</code>
The keys that are used to store the data have the form <code>&lt;storeBeanName&gt;:&lt;channelId&gt;</code>
(in the above example, <code>redisMessageStore:somePersistentQueueChannel</code>).
</para>
<para>

View File

@@ -9,6 +9,13 @@
in more details, please see the Issue Tracker tickets that
were resolved as part of the 4.0 development process.
</para>
<para>
Please be sure to also see the
<ulink url="https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-3.0-to-4.0-Migration-Guide"
>Migration Guide</ulink> for important changes that might affect your applications.
Migration guides for all versions back to <emphasis>2.1</emphasis> can be found on the
<ulink url="https://github.com/spring-projects/spring-integration/wiki">Wiki</ulink>.
</para>
<section id="4.0-new-components">
<title>New Components</title>
<section id="4.0-mqtt">