I think the right approach to something like this would be to use the existing service definition support and write a protoc plugin that does the code gen. To layer on extra things -- for concepts/features that OSGI supports but that can't be modeled just with proto service definitions -- you could probably use custom options for services and methods. More complicated things may require clever modeling with the request/response types (and maybe custom message and field options, too). These primitives can likely take you pretty far, without introducing any special syntax or keywords in protos.
---- *Josh Humphries* [email protected] On Tue, Apr 25, 2017 at 6:53 PM, Scott Lewis <[email protected]> wrote: > I've been happily using protocol buffers to implement Java <-> Python > interaction using OSGi Remote Services [1,2]. > > Remote Services is a spec that extends OSGi services to out-of-process > access. A nice thing about the Remote Services spec is that it is > transport-independent...allowing arbitrary wire protocols and > serialization formats via a distribution provider. For example, I've > created distribution providers based upon Py4j [1], and grcp/protocol > buffers [2]. The distribution provider(s) can be selected at runtime for > individual remote services. > > One thought I've had would be to allow remote services to be declared in > .proto files, and generate the osgi remote service a) metadata; b) impl > code; c) client code. > > I think one way to do this would be to implement protoc language additions > for handling the service keyword, as grcp does. Another way would be to > add something like osgiremoteservice keyword to protoc for handling > declaring and generating osgi remote services across multiple languages. > > Question: Is there a way to add a new keyword to protoc? I would prefer > not to just provide an impl of the existing proto3 'service' keyword, > because an osgi remote service has other/additional behavior (e.g. > dynamics, async access, etc) based upon the OSGi service registry. > > Thanks, > > Scott > > [1] https://github.com/ECF/Py4j-RemoteServicesProvider > > [2] https://github.com/ECF/grpc-RemoteServicesProvider > > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
