Hi,

You can put the encoding information on Exchange like this
exchange.setProperty(Exchange.CHARSET_NAME, “UTF_8”);

On 1/9/12 8:58 PM, xiangqiuzhao wrote:
my Encoder:

protected Object encode(
             ChannelHandlerContext ctx, Channel channel, Object msg) throws
Exception {
         if (!(msg instanceof String)) {
             return msg;//(1)
         }
         System.out.println("IN INCODE:" + msg);
         buf.writeBytes(data); //6bytes
         return buf;//(3)
     }

my camelContext:

SimpleRegistry registry = new SimpleRegistry();
         registry.put("myEncoder", encoder);
         CamelContext context = new DefaultCamelContext(registry);

my routeBuilder:

context.addRoutes(new RouteBuilder() {
             public void configure() throws Exception {
                 from("direct:cpsp")
                 .process(new MyToProcessor())
                 .to("netty:tcp://localhost:6789?sync=true")
                 .process(new MyFromProcessor());
             }
         });

why my server recved 9bytes??

and how camel know  the encoder i put in DefaultCamelContext?

--
View this message in context: 
http://camel.465427.n5.nabble.com/in-netty-why-sended-6bytes-but-server-recved-9bytes-tp5131271p5131271.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Reply via email to