1

As far as I understand, in Netty ChannelOutboundHandlerAdapter is meant for outbound IO operations: that is writes, but a class implementing ChannelOutboundHandlerAdapter can also implement a read method, which seems incorrect to me, why should a component meant for writing have a read method.

The opposite component, that is ChannelInboundHandlerAdapter which is meant for inbound IO operations, ie reads, does not have a write method. This sounds correct.

Why does ChannelOutboundHandlerAdapter makes it possible to implement a read method if it is supposed to push data out of the pipeline?

Finlay Weber
  • 2,989
  • 3
  • 17
  • 37

1 Answers1

2

read() signals the willingness to read something from the socket as soon as there is something that can be read. It basically tells netty that we should do a read at some point.

Norman Maurer
  • 23,104
  • 2
  • 33
  • 31
  • but why should a component responsible for writing out data have the ability to "signal the willingness to read something from the socket as soon as there is something that can be read" – Finlay Weber Mar 24 '21 at 19:48
  • 1
    It is not only responsible for writing but also other "outbound" operations. This way you can implement back pressure etc. – Norman Maurer Mar 24 '21 at 20:23