<p>Hello. I guess it also depends on how complex your protocol is. Personally, I am using a decoder that switches between the different possible ones based on state. It gets the job done. </p>
<div class="gmail_quote">On 02-Jun-2011 6:33 PM, "alex77" <<a href="mailto:alejandro.domenech@citi.com">alejandro.domenech@citi.com</a>> wrote:<br type="attribution">> Hi everyone.<br>> <br>> I'm quite new to Netty and I've spent the last week looking for information<br>
> and examples about how to implement a client-server communication protocol<br>> using Netty and protobuf that supports multiple protobuf messages. As<br>> everyone else, I took a look to the example in the doc, but as usual, the<br>
> protocol only contains one single protobuf message.<br>> <br>> I've found some posts with suggestions about using an envelope message that<br>> will contain the actual protobuf data making use of extensions, and also an<br>
> alternative suggesting to write a protocol that will prepend the message<br>> type, the length and then the actual protobuf data, so on reception you<br>> could use a DecoderEmbedder that will instanciate the proper ProtobufDecoder<br>
> depending on the message type.<br>> <br>> Also I saw some recent code contribution trying to implement a generic<br>> decoder that will accept in the constructor a map of ProtobufDecoders (or a<br>> list and build the map from it) to try to figure out what's the right one to<br>
> use depending on the message type.<br>> <br>> All these seem to be attempts or suggstions, and I was wondering if there's<br>> a proper way (the official Netty way) to solve this type of problem, as I<br>
> guess it's quite common. Is there any plan to add support in a future<br>> release a decoder to do this demultiplexing functionality?<br>> <br>> Not sure the solution Trustin pointed <br>> <a href="http://www.jboss.org/netty/community.html#nabble-td3931395">http://www.jboss.org/netty/community.html#nabble-td3931395</a> here is a good<br>
> one, as it instanciates a new DecoderEmbedder with a new instance of the<br>> concrete protobuf decoder every time we parse the body of a message. Indeed<br>> it shows the general idea, but sure there's an efficient way to solve this<br>
> problem.<br>> <br>> Many thanks in advance!<br>> <br>> --<br>> View this message in context: <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Netty-and-protobuf-protocol-with-complex-messages-tp6431047p6431047.html">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Netty-and-protobuf-protocol-with-complex-messages-tp6431047p6431047.html</a><br>
> Sent from the Netty User Group mailing list archive at Nabble.com.<br>> _______________________________________________<br>> netty-users mailing list<br>> <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/netty-users">https://lists.jboss.org/mailman/listinfo/netty-users</a><br></div>