1

I need to modify a channel pipeline outside of the factory.

ChannelPipelineFactory factory = new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline pipeline = pipeline();
                pipeline.addLast("decoder", new StringDecoder());
                pipeline.addLast("encoder", new StringEncoder());
                return pipeline;
            }
};

factory getPipeline() gets called when I create a new channel.

When I send a message on this channel, I call

channel.getPipeline().addLast("id",handler);

but when some milliseconds later a message arrives for the same channel, and I call channel.getPipeline().get("id") this gives a null value. Is there a way to tell netty that a pipeline is modified, or shouldn't I call addLast outside of the factory?

Thanks, Leen

4

0 回答 0