Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netty nested pipelines / multiplexing

I'm pretty new to Netty, but how would one implement a case in Netty 4.x when several protocols (e.g. P1 and P2) are encapsulated inside another protocol?

              +-------------+
              |   decoder   |
              +-------------+
              |   encoder   |
              +-------------+
              |    muxer    |
              +-------------+
              |   demuxer   |
              +---+------+--+
                  |      |
                  |      |
           +------+      +------+
           |                    |
           |                    |
           v                    v
    +-------------+      +-------------+
    | P1 decoder  |      | P2 decoder  |
    +-------------+      +-------------+
    | P1 encoder  |      | P2 encoder  |
    +-------------+      +-------------+
    | P1 handler  |      | P2 handler  |
    +-------------+      +-------------+

Is there a way to create nested pipelines, so that decoder<->encoder<->muxer<->demuxer being the main pipeline would send the data along P1 or P2 pipeline based on the decision of demuxer?

Or maybe there is a way to somehow create (for the sake of clarity) "subchannels" with their own pipelines?

like image 692
avtolstoy Avatar asked Mar 19 '13 12:03

avtolstoy


1 Answers

There is no support for "nested Pipelines" yet. It may be part of 4.1.0. For now you need to remove/add handlers on the fly.

See [1] for an example.

[1] https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/portunification/PortUnificationServerHandler.java

like image 115
Norman Maurer Avatar answered Oct 18 '22 10:10

Norman Maurer