I am working on upgrading an Netty3 application to Netty4. The application currently uses custom events by extending the ChannelEvent
class and I am not sure how to translates this to Netty 4 because ChannelEvent
seem to have been gone in Netty4, and unlike in Netty3, in Netty 4, there is no handler method that receives a channel event.
The current code in Netty 3 looks like this:
A custom event is defined:
public class CustomEvent implements ChannelEvent {}
and in some handler down the line, there is some code that uses the event. For example:
public class AppHandler extends SimpleChannelDownstreamHandler {
@Override
public void handleDownstream(ChannelHandlerContext context, ChannelEvent event) {
event.getChannel().write(new CustomEvent(...))
context.sendDownstream(event)
}
}
How can this be translated to Netty 4? Not just the custom event part but also the context.sendDownstream(event)
method call as this is no longer in Netty 4 also.
question from:
https://stackoverflow.com/questions/65935307/replacement-for-channelevent-and-customevent-in-netty-4 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…