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