INT-3521 completions for ChannelInterceptorList

JIRA: https://jira.spring.io/browse/INT-3521

INT-3521: Rework invocation `index` to the `Deque` of invoked interceptors

Conflicts:
	src/reference/docbook/whats-new.xml

INT-3521: Address PR comments

Create an `interceptorStack` only if there are `interceptor` on the channel.
Invoke `afterSend(Receive)Completion` only `if (interceptorStack != null)`

Minor Doc Polishing
This commit is contained in:
Artem Bilan
2014-09-26 11:15:02 +03:00
committed by Gary Russell
parent fa03c6f268
commit 134aa5923e
7 changed files with 326 additions and 52 deletions

View File

@@ -306,9 +306,13 @@
void postSend(Message<?> message, MessageChannel channel, boolean sent);
void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex);
boolean preReceive(MessageChannel channel);
Message<?> postReceive(Message<?> message, MessageChannel channel);
void afterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex);
}]]></programlisting>
After implementing the interface, registering the interceptor with a channel is just a matter of calling:
<programlisting language="java">channel.addInterceptor(someChannelInterceptor);</programlisting>
@@ -363,6 +367,14 @@
precede postReceive.
</tip>
</para>
<para>
Starting with <emphasis>Spring Framework 4.1</emphasis> and Spring Integration 4.1, the
<interfacename>ChannelInterceptor</interfacename> provides new methods - <code>afterSendCompletion()</code>
and <code>afterReceiveCompletion()</code>. They are invoked after <code>send()/receive()</code> calls,
regardless of any exception that is raised, thus allowing for resource cleanup. Note, the
Channel invokes these methods on the ChannelInterceptor List in the reverse order of the
initial <code>preSend()/preReceive()</code> calls.
</para>
</section>
<section id="channel-template">

View File

@@ -272,5 +272,14 @@
See <xref linkend="channel-configuration-queuechannel"/>.
</para>
</section>
<section id="4.1-channel-interceptor">
<title>ChannelInterceptor Changes</title>
<para>
The <interfacename>ChannelInterceptor</interfacename> now supports additional
<code>afterSendCompletion()</code> and <code>afterReceiveCompletion()</code> methods.
See <xref linkend="channel-interceptors"/>.
</para>
</section>
</section>
</chapter>