First, in Netty 3.X the packages were from org.jboss.netty.* see: http://netty.io/3.10/api/index.html,
But started Netty 4.X the packeages are from io.netty.* see: http://netty.io/4.0/api/index.html
Now, if you are using Netty 4.X to read message use the method
ChannelRead(ChannelHandleContext ctx, Object msg) { ... }
inherited from ChannelInboundHandlerAdapter class.
The method:
messageReceived(ChannelHandlerContext, I) { ...}
was used in Netty 3.X version.
EDIT: Adding @trustin (developer of Netty) comment,
channelRead0 is from SimpleChannelInboundHandler of 4.x, and it will be renamed to messageReceived in Netty 5.
Hope it helps.
本文对比了Netty 3.x与4.x版本中消息读取方法的变化。Netty 4.x中使用ChannelRead方法替代了之前的messageReceived方法,并介绍了SimpleChannelInboundHandler中的channelRead0方法,该方法在Netty 5.x中将更名为messageReceived。
2935

被折叠的 条评论
为什么被折叠?



