From 62fc29f1309d6be70bf77fe27edf43002e370b9b Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 17 Nov 2010 10:48:27 -0500 Subject: [PATCH] INT-1630 updated thread-local channel section --- docs/src/reference/docbook/channel.xml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/src/reference/docbook/channel.xml b/docs/src/reference/docbook/channel.xml index 90b9bb8e8e..c0617c10a4 100644 --- a/docs/src/reference/docbook/channel.xml +++ b/docs/src/reference/docbook/channel.xml @@ -236,15 +236,23 @@
- ThreadLocalChannel + Thread-Scoped Channel - The final channel implementation type is ThreadLocalChannel. This channel also delegates - to a queue internally, but the queue is bound to the current thread. That way the thread that sends to the - channel will later be able to receive those same Messages, but no other thread would be able to access them. - While probably the least common type of channel, this is useful for situations where - DirectChannels are being used to enforce a single thread of operation but any reply - Messages should be sent to a "terminal" channel. If that terminal channel is a - ThreadLocalChannel, the original sending thread can collect its replies from it. + Spring Integration 1.0 provided a ThreadLocalChannel implementation, but that has been removed as of 2.0. Now, there is a more general way for handling the same requirement by simply adding a "scope" attribute to a channel. The value of the attribute can be any name of a Scope that is available within the context. For example, in a web environment, certain Scopes are available, and any custom Scope implementations can be registered with the context. Here's an example of a ThreadLocal-based scope being applied to a channel, including the registration of the Scope itself. + + + + + + + + + + + +]]> + + The channel above also delegates to a queue internally, but the channel is bound to the current thread, so the contents of the queue are as well. That way the thread that sends to the channel will later be able to receive those same Messages, but no other thread would be able to access them. While thread-scoped channels are rarely needed, they can be useful in situations where DirectChannels are being used to enforce a single thread of operation but any reply Messages should be sent to a "terminal" channel. If that terminal channel is thread-scoped, the original sending thread can collect its replies from it.