La clase pública MessageHandler extiende ChannelInboundHandlerAdapter implementa ChannelOutboundHandler {
@Anular
public void channelActive (ChannelHandlerContext ctx) lanza Exception {
Map newMap = new HashMap <> ();
// Reenviar el mensaje cada tres segundos
ctx.executor (). scheduleAtFixedRate (() -> {
if (map.size ()> 0)
{
map.forEach ((k, v) -> {
ctx.writeAndFlush (v.data);
v.times = v.times + 1;
si (v. veces <3)
{
// Mantente ausente tres veces.
newMap.put (v.id, v);
}
});
}
map = newMap;
}, 3, 3, TimeUnit.SECONDS);
}
}