Building a service that talks protocol buffers

Utkarsh Srivastava utkarsh at gmail.com
Tue Mar 10 20:22:16 EDT 2009


Hi folks,

Are there any recommendations/examples to follow while building a service
over Netty? My service has multiple methods and uses protocol buffers for
message serialization.

Protocol buffers do let you define services, but the generated code expects
an RPC interface and doesn't look like it can fit cleanly into Netty.

So it looks like the only option is to declare a message such as

message Request{
    enum RequestType { READ = 1; WRITE = 1; }
    required RequestType requestType = 1;
    optional ReadRequest readRequest = 2;
    optional WriteRequest writeRequest = 3;
}

And then in the netty handler decide whether its a write call or a read call
based on the enum, and then pass the appropriate optional field (readRequest
or writeRequest) to the next handler.

Is this the recommended way or is there something cleaner I can do?

Utkarsh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090310/915f40b6/attachment.html 


More information about the netty-users mailing list