if i use encoders and decoders property, the program is ok. 

        Object decoder = new LengthDecoder(); //appctx.getBean("mydecoder");
        Object encoder = new MessageEncoder(10);
//appctx.getBean("myencoder");
        
        SimpleRegistry registry = new SimpleRegistry(); 
        
        List<ChannelDownstreamHandler> encoders = new
ArrayList<ChannelDownstreamHandler>();
        List<ChannelUpstreamHandler> decoders = new
ArrayList<ChannelUpstreamHandler>();
        encoders.add((ChannelDownstreamHandler)encoder);
        decoders.add((ChannelUpstreamHandler)decoder);
        
        registry.put("myDecoder", decoder);
        registry.put("myEncoder", encoder);
        registry.put("myEncoders", encoders);
        registry.put("myDecoders", decoders);
        
        CamelContext context = new DefaultCamelContext(registry);

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

but if i use the netty uri like:


.to("netty:tcp://localhost:6789?encoder=myEncoder&decoder=myDecoder&sync=true")

exception with :

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint:
netty://tcp://localhost:6789?decoder=myDecoder&encoder=myEncoder&sync=true
due to: Could not find a suitable setter for property: decoder as there
isn't a setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type: java.lang.String
to the required type: org.jboss.netty.channel.ChannelUpstreamHandler with
value myDecoder
        at

Caused by: java.lang.IllegalArgumentException: Could not find a suitable
setter for property: decoder as there isn't a setter method with same type:
java.lang.String nor type conversion possible: No type converter available
to convert from type: java.lang.String to the required type:
org.jboss.netty.channel.ChannelUpstreamHandler with value myDecoder


what's wrong? MyDecoder is type of ChannelUpstreamHandler. why is
java.lang.String? 


--
View this message in context: 
http://camel.465427.n5.nabble.com/about-netty-encoder-and-encoders-tp5479417p5479417.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to