You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Scott Lewis <sl...@composent.com> on 2020/05/06 02:36:35 UTC

OSGi Remote Services with gRCP

I've created a new distribution provider based upon/using Google's grpc 
[1].   For reference, here [2] are all the available distribution 
providers for ECF's impl of OSGi Remote Services/Remote Service Admin.

grpc-java uses the Google protocol buffers (protobuf) compiler to 
generate Java classes from a proto file.   The ECF grcp provider also 
has a new protoc plugin that...when generating the protobuf+grpc-java 
classes with maven build...will generate a service interface  also.   
Meaning:  from a single proto file that describes the service methods 
and args+return values, an entire remote service API can be generated.

Please see the example described here [1] or the blog posting here [3] 
for more info about this new provider.

There is a Karaf feature here [4] with dependencies, the grpc 
distribution provider, and the healthcheck example code.

Scott

[1] https://github.com/ECF/grpc-RemoteServicesProvider

[2] https://wiki.eclipse.org/Distribution_Providers

[3] 
http://eclipseecf.blogspot.com/2020/05/using-googles-grpc-java-for-osgi-remote.html

[4] 
https://raw.githubusercontent.com/ECF/grpc-RemoteServicesProvider/master/build/karaf-features.xml


Re: OSGi Remote Services with gRPC

Posted by Scott Lewis <sl...@composent.com>.
On 5/7/2020 4:55 AM, Maurice Betzel wrote:
> Since default java serialization is on it’s way out your work will definitely
> gain traction within DOSGi and for my setup this is a attractive
> alternative. I the need arises I will extend it myself and create a pull
> request.

That would be  great.   Feel free to use the health.proto here [1] if 
you wish.

BTW, what languages are you most interested in?   ECF already has Python 
<-> Java remote services distribution provider available here [2].  It 
does not currently use grpc however.

>This could also be a good blueprint for Apache Thrift. Exchangeable
>protocols is wishful thinking 🤔.

Same as it ever was.   Difficulty is:  'one protocol to rule them all' 
is also wishful thinking ;-)

Scott

[1] 
https://github.com/ECF/grpc-RemoteServicesProvider/tree/master/examples/org.eclipse.ecf.examples.provider.grpc.health.api/src/main/proto

[2] https://github.com/ECF/Py4j-RemoteServicesProvider


>
> -----
> if ( you want ) { you can } else { you can't }
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: OSGi Remote Services with gRCP

Posted by Maurice Betzel <m....@gaston-schul.com>.
Since default java serialization is on it’s way out your work will definitely
gain traction within DOSGi and for my setup this is a attractive
alternative. I the need arises I will extend it myself and create a pull
request. This could also be a good blueprint for Apache Thrift. Exchangeable
protocols is wishful thinking 🤔.



-----
if ( you want ) { you can } else { you can't }
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: OSGi Remote Services with gRCP

Posted by Scott Lewis <sl...@composent.com>.
Hi Maurice,

On 5/6/2020 10:10 AM, Maurice Betzel wrote:
> Rephrasing the question, does this bring extended functionality to other
> protobuf supported languages as well?

Short answer:  yes...because grpc supports other languages.

Longer answer:   Because ECF is an impl of OSGi RS/RSA spec the work 
I've done on this new distribution provider is first focused on 
Java/OSGi (e.g. adding a protobuf plugin that generates a Java service 
interface class from proto file service spec).

However, since we are talking about inter-process, and grpc can create 
servers or clients in other languages, and because all communication is 
based on same (gprotouf+grpc) wire protocol and serialization, then it 
is possible to have either

Java/OSGi Remote Services consumer/client ->  Other lang server

or

Other lang consumer/client -> Java/OSGi Remote Services server

If there is interest in this I (or others) could produce an example, but 
since I've just finished the first cut of this distribution provider 
(for Java/OSGi on both ends) I have not yet had a chance to work on 
these multi-language use cases.

Scott


>
>
>
> -----
> if ( you want ) { you can } else { you can't }
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: OSGi Remote Services with gRCP

Posted by Maurice Betzel <m....@gaston-schul.com>.
Rephrasing the question, does this bring extended functionality to other
protobuf supported languages as well?



-----
if ( you want ) { you can } else { you can't }
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: OSGi Remote Services with gRCP

Posted by Maurice Betzel <m....@gaston-schul.com>.
Now I remember why I mostly used Apache Thrift instead of protobuf, it has
official php support. I usually generate the model in one jar like this: 
kie-server-java/pom.xml
<https://github.com/Maurice-Betzel/org.kie.server.thrift/blob/master/kie-server-java/pom.xml>  



-----
if ( you want ) { you can } else { you can't }
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: OSGi Remote Services with gRCP

Posted by Maurice Betzel <m....@gaston-schul.com>.
Hi Scott, I mainly used protobuf and other binary protocols for communication
in heterogeneous environments.
I guess for a pure Java environment this could more easily span multiple JRE
versions in comparison with the default Java serialization mechanism. In
your setup, could I also create a stub for, let’s say, a php client?



-----
if ( you want ) { you can } else { you can't }
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html