Class DatagramPacketEncoder<M>

Type Parameters:
M - the type of message to be encoded
All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler

public class DatagramPacketEncoder<M> extends MessageToMessageEncoder<AddressedEnvelope<M,InetSocketAddress>>
An encoder that encodes the content in AddressedEnvelope to DatagramPacket using the specified message encoder. E.g.,

 ChannelPipeline pipeline = ...;
 pipeline.addLast("udpEncoder", new DatagramPacketEncoder(new 
invalid reference
ProtobufEncoder
(...));
Note: As UDP packets are out-of-order, you should make sure the encoded message size are not greater than the max safe packet size in your particular network path which guarantees no packet fragmentation.