i had implements my Decoder named MessageDecoder. and use by from("host:port?decoder=com.test.MessageDecoder"), but where i need to put the class?
second, why need use decoders and encoders? if i need implements some decoder, why not to implements a big decoder? public class MessageDecoder extends FrameDecoder { @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { if (buffer.readableBytes() < 4) { return null;//(1) } int dataLength = buffer.getInt(buffer.readerIndex()); if (buffer.readableBytes() < dataLength + 4) { return null;//(2) } buffer.skipBytes(4);//(3) byte[] decoded = new byte[dataLength]; buffer.readBytes(decoded); String msg = new String(decoded);//(4) return msg; } } -- View this message in context: http://camel.465427.n5.nabble.com/Netty-for-TCP-communication-tp3409969p5105286.html Sent from the Camel - Users mailing list archive at Nabble.com.