4ntoine
4ntoine

Reputation: 20422

How to connect to gRPC C++ InProcessChannel not from C++?

I'm trying gRPC as JNI alternative and the idea is to have gRPC service on C++ side and client connected on Java/Android side. In order to have the best possible performance i'd prefer to use in-process channel (open to your suggestions).

How can i connect to C++ gRPC server with InProcessChannel()? The problem is that i need to pass a name for Java's InProcessServerBuilder.

In C++ gRPC tests (eg. here) i can't find it's set and it makes me think InProcessChannel can be used in pure C++ only (both server and client are in C++). Is it still possible for C++ service and Java client?

PS. I was able to do it for Java-server + Java-client.

PPS. I've found a couple of similar QnAs eg. here but i wonder if there is still a way to make it working together (probably with some 3rd-party channel impl). Can it work over Unix Domain Sockets?

Upvotes: 4

Views: 2737

Answers (2)

4ntoine
4ntoine

Reputation: 20422

I've accepted Eric's Anderson answer as correct. However it might be useful to know how i made it working with Unix Domain Sockets.

I had to patch netty for Android and use it. Pay your attention to some Android-specific permission notes.

Upvotes: 2

Eric Anderson
Eric Anderson

Reputation: 26464

The C++ and Java "in-process" transports weren't named appropriately for cases multiple languages are in the same process. The in-process transports only work within each individual language; the C++ and Java in-process transports can't interact.

You should use the normal HTTP/2 client/server.

While something like you want could exist, as maybe a "shared memory" transport, it is a significant amount of work and would see relatively little usage for the maintenance burden.

Upvotes: 5

Related Questions