Inbound vs Outbound Handlers¶
In the context of the Netty ChannelPipeline, Inbound and Outbound handlers represent the two primary directions of data flow and event processing within a network application^[600-developer__big-data__netty__netty-ChannelPipeline.md].
ChannelPipeline Architecture¶
A ChannelPipeline is automatically created when a new channel is established^[600-developer__big-data__netty__netty-ChannelPipeline.md]. It manages a list of channel handlers, which can be added or removed dynamically at runtime^[600-developer__big-data__netty__netty-ChannelPipeline.md]. The pipeline acts as a container where handlers are organized to intercept and handle I/O events, either incoming from the network (Inbound) or outgoing to the network (Outbound)^[600-developer__big-data__netty__netty-ChannelPipeline.md].
Handler Types¶
- Inbound Handlers: These handlers process incoming I/O events, typically starting from
Socket.read()operations^[600-developer__big-data__netty__netty-ChannelPipeline.md]. They are triggered byfireIN_EVTmethod calls passed throughChannelHandlerContext^[600-developer__big-data__netty__netty-ChannelPipeline.md]. - Outbound Handlers: These handlers process outgoing I/O requests, typically culminating in
Socket.write()operations^[600-developer__big-data__netty__netty-ChannelPipeline.md]. They are triggered byOUT_EVTmethod calls^[600-developer__big-data__netty__netty-ChannelPipeline.md].
Execution Order¶
The order in which handlers are added to the pipeline dictates their execution sequence, which differs significantly between inbound and outbound flows^[600-developer__big-data__netty__netty-ChannelPipeline.md].
- Inbound Flow: Inbound events are processed starting from the "head" of the pipeline (the first handler added) and move "down" the chain^[600-developer__big-data__netty__netty-ChannelPipeline.md]. For example, if handlers are added in the order
1, 2, 3, 4, 5, an inbound event will trigger1, then2, and finally5(assuming only these are Inbound handlers)^[600-developer__big-data__netty__netty-ChannelPipeline.md]. - Outbound Flow: Outbound events are processed starting from the "tail" of the pipeline (the last handler added) and move "up" the chain^[600-developer__big-data__netty__netty-ChannelPipeline.md]. Using the same order
1, 2, 3, 4, 5, an outbound event will trigger5, then4, and then3(assuming only these are Outbound handlers)^[600-developer__big-data__netty__netty-ChannelPipeline.md].
Related Concepts¶
- [[Netty]]
- ChannelPipeline
Sources¶
^[600-developer__big-data__netty__netty-ChannelPipeline.md]