diff --git a/docs/src/reference/docbook/channel.xml b/docs/src/reference/docbook/channel.xml index 00a5ece6c2..1876792ff9 100644 --- a/docs/src/reference/docbook/channel.xml +++ b/docs/src/reference/docbook/channel.xml @@ -584,6 +584,49 @@ public Message receive(final PollableChannel channel) { ... }]]>true enables logging of all headers in addition to the payload. + + + A little more on Wite Tap + + + One of the common misconception about the wire tap and some time other similar components () + that they are asynchronous in nature. Wire-tap as a component is neither sync nor async. + In fact non of the components in SI are sync or async except for. . . well read on. + + What makes certain parts of the message flow sync or async is the Message Channel + abstraction. That is why from the inception of the framework we always emphasize the need and the value of the Message Channel + and that is why Spring Integration is the only framework at the time of writing where Message Channel + is a "first class citizen" of the framework (not an internal realization of EIP pattern) fulle exposed to you - the end user. + + So, Wire-tap component is ONLY responsible to perform the following 3 tasks: + + + wire-tap into a message flow by tapping into a channel (e.g., channelA) + + + grab a copy of a message + + + send it to another channel (e.g., channelB) + + + + + Look at it as a variation of the Bridge (nothing more). But by bridging one channel with another wire-tap is essentially + initiates (forks) another message flow. Is this flow synchronous or asynchronous? + That is the ultimate question and the answer simply depends on the type of Message Channel 'channelB' is. + And as you know we have: Direct Channel, Pollable Channel and Executor Channel. + The last two do break the thread boundary making communication via such channels asynchronous simply because + the dispatching of the message from the channel happens on the different thread then the one that sent the message to that channel + and that is what is going to make your wire-tap flow sync or async. + It is consistent with other components within the framework (e.g., Message Publisher) and if you think about it its in a way + brings a level of simplicity by sparing you form worrying in advance (other then writing thread safe code) wether a + particular piece of code should be implemented as sync or async. In fact its always neither, + the code is just a function. The actual wiring of two pieces of code (component A and component B) via Message Channel + is what's going to make their collaboration sync or async. You may even want to change + from sync to async in the future and Message Channel is what's going + to allow you to do it swiftly without ever touching the code +