gRPC c-based vs gRPC-java ?

207 views
Skip to first unread message

Rob Cecil

unread,
Aug 4, 2015, 10:06:43 AM8/4/15
to grpc.io
Is there a page describing the differences between these two and their history? Being new to gRPC, and only interested in the c-based versions (csharp, and ObjC), I only recently noticed the differences. For example:

https://groups.google.com/d/topic/grpc-io/JApjQAGe2q4/discussion  ("How to set & retrieve a user ID after authenicating?")

This is a topic I am interested in, but I cannot find the equivalent parts in the c-based API (started with ServerInterceptor).

Be great to know how to navigate between the two, e.g. know what features are only in one and not the other, etc.

Thanks!


Eric Anderson

unread,
Aug 4, 2015, 12:06:34 PM8/4/15
to Rob Cecil, grpc.io
We don't have such a guide. Eventually I would hope we have enough examples that you could compare them across languages. The differences you will see will mainly vary by language instead of implementation; grpc-go, grpc (C core), and grpc-java support the same wire protocol. How higher-level features are exposed and composed is the thing that varies much more, since we have put a lot of effort into making each language's APIs natural for each language.

Most features are present across the languages, or will be soon. Some "minor" differences may exist, like whether having two stubs creates two channels; some languages allow stubs to share channels and some do not. There tend to be reasons behind the difference in design, but both are "reasonable" for different usage patterns.

You do point out a case where Java has a feature that others do not: interceptors. The C core has interceptors, but they aren't for application use. They are an internal implementation detail. I don't think another language has interceptors at present. It's my understanding there isn't yet consensus which languages should support interceptors for application-use.

I work on the Java implementation, so others may correct me if I'm wrong.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b0d31db7-4914-47f7-8379-c0b80113f360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rob Cecil

unread,
Aug 4, 2015, 5:42:11 PM8/4/15
to grpc.io, rob....@gmail.com
Ok, been reading more today. As I understand it, if I want "Caller identification is typically done by inspecting some metadata passes between caller and server (a header)", I can do something like:

            client.HeaderInterceptor = (metadata) => 
            {
                metadata.Add(new Metadata.Entry("custom-header""abcdef"));
            };

But, in my case, pass a hash, etc. of a userid, through?

Is that the correct mechanism?

Thx

Eric Anderson

unread,
Aug 4, 2015, 7:10:49 PM8/4/15
to Rob Cecil, grpc.io
On Tue, Aug 4, 2015 at 2:42 PM, Rob Cecil <rob....@gmail.com> wrote:
Ok, been reading more today. As I understand it, if I want "Caller identification is typically done by inspecting some metadata passes between caller and server (a header)", I can do something like:

            client.HeaderInterceptor = (metadata) => 
            {
                metadata.Add(new Metadata.Entry("custom-header""abcdef"));
            };

But, in my case, pass a hash, etc. of a userid, through?

Is that the correct mechanism?

Yes. Metadata actually translates pretty directly to HTTP headers. So if you would have used HTTP headers if you weren't using gRPC, you want Metadata in gRPC.
Reply all
Reply to author
Forward
0 new messages