Google protocol Buffer Codec

ritom ritom at hotmail.com
Sat Jan 2 08:16:33 EST 2010


Thanks for very much for the insight. If you do have multiple messages how to
you handle them in the decoder. In the example looks like everything is
based on one object what if you have two message type Foo and Bar instead of
LocalTimeProtocol alone. Can you please give a example. Thanks a lot in
advance.

  p.addLast("protobufDecoder", new
ProtobufDecoder(LocalTimeProtocol.Locations.getDefaultInstance()));


Thingfish wrote:
> 
> Hi
> 
> The easiest solution is to wrap all your messages in a 'union type' as
> described in this protobuf tutorial:
> http://code.google.com/intl/da-DK/apis/protocolbuffers/docs/techniques.html#union
> 
> Alternatively you will have to manually prepend some kind of command id to
> identity the kind of protobuf message being sent, but unlikely to be worth
> the trouble.
> 
> 
> Regards
> Jannick
> <http://code.google.com/intl/da-DK/apis/protocolbuffers/docs/techniques.html#union>
> 
> 2010/1/2 ritom <ritom at hotmail.com>
> 
>>
>> Can somebody please help me understand the google protobuf support within
>> Netty.
>> In the LocalTimeServerPipelineFactory example we have
>>
>> p.addLast("protobufDecoder", new
>> ProtobufDecoder(LocalTimeProtocol.Locations.getDefaultInstance()));
>>
>> That would mean we can now receive the Locations message in
>> TimeServerHandler.
>>
>>  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
>>        Locations locations = (Locations) e.getMessage();
>>
>> How would I implement support for multiple incoming message types where
>> you
>> might be receiving different types of request from the client. Lets say
>> you
>> are receiving Logon first then BalanceRequest, TransferRequest and so on.
>> Also server will reply with multiple Message Types depending on the
>> request.
>> Can somebody please please help.
>>
>> Tom
>> --
>> View this message in context:
>> http://n2.nabble.com/Google-protocol-Buffer-Codec-tp4241485p4241485.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Google-protocol-Buffer-Codec-tp4241485p4242473.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list