2017-07-07 3 views
0

私はラクダの初心者です。私は私の問題を解決するためのヒントを得たいです。 はここcamel netty4 ChannelHandlerFactory ByteToMessageDecoderエラー

完全なソースリンク私のコードです:https://github.com/kcy0142/camel_netty_test

@Configuration 
public class ChannelHandlerFactoryByteArrayDecoder implements ChannelHandlerFactory { 

    @Bean(name="vpaByteDecoder") 
    @Qualifier("vpaByteDecoder") 
    public ChannelHandler newChannelHandler() { 
     return (ChannelHandler) new VpaByteDecoder(); 
    } 
    public class VpaByteDecoder extends ByteToMessageDecoder{ 

    } 
} 

と私のルータは

from("netty4:tcp://localhost:8004?textline=true&sync=true&decoders=#vpaByteDecoder&encoders=#stringEncoder"). 

で、エラーはすべきで共有可能ではない。この

io.netty.channel.ChannelPipelineException: config.ChannelHandlerFactoryDecoder$VpaByteDecoder is not a @Sharable handler, so can't be added or removed multiple times. 

ByteToMessageDecoderようにして起動します。だから私はChannelHandlerFactoryをimplentmented

私は理由を知っていない私の問題を理解する方法を表示します。それが動作

答えて

0

その豆の方法ではないと命名されなければならないファクトリクラス、代わりにこのような何かを、そして@Bean

@Component(name="vpaByteDecoder") 
public class ChannelHandlerFactoryByteArrayDecoder implements ChannelHandlerFactory { 
+0

を削除します。ありがとう。ラクダを使うことは私の名誉です。 – james

関連する問題