https://github.com/grpc/grpc-java/pull/3086 will add the details to gRPC's
MethodDescriptor as well. It also adds ProtoServiceDescriptorSupplier and
ProtoMethodDescriptorSupplier for convenience. (The schema object in the
service implements the file and service descriptor suppliers, the schema
object in the method implements all three.)

It looks like the review stalled. I've poked it. Since it adds an API used
by the generated code we can't mark the API ExperimentalApi, so it required
a heavier amount of review.

On Wed, Jul 19, 2017 at 10:30 AM, 'Ran Bi' via grpc.io <
[email protected]> wrote:

> Thanks, Josh. It is helpful!
>
> On Wed, Jul 19, 2017 at 7:28 AM Josh Humphries <[email protected]>
> wrote:
>
>> I'm guessing you are interested in doing this with Java (since I see
>> "[grpc-java]" in the subject).
>>
>> You can query the grpc ServiceDescriptor for its "schema descriptor".
>> For proto-generated services, this will be a ProtoFileDescriptorSupplier,
>> that provides access to the FileDescriptor, which in turn contains
>> everything you're looking for.
>>
>> The slight trick is that the interceptor, with each call, only sees a
>> MethodDescriptor for the method being invoked, which does not appear to
>> have a reference back to its enclosing ServiceDescriptor. So you'd need
>> to construct a "sidecar" map that allows access to the service descriptors
>> from the interceptor(s).
>>
>> Here's a gist that demonstrates this: https://gist.github.com/jhump/
>> e8f67087ec5a3918f7b270a4a2b83516 (the sidecar map is the
>> MethodOptionsRegistry).
>>
>> (Word of warning: I have not tried to actually compile and run the gist,
>> so you may find some small errors. But it should at least be instructive in
>> showing everything you actually need.)
>>
>>
>>
>> ----
>> *Josh Humphries*
>> [email protected]
>>
>> On Tue, Jul 18, 2017 at 1:40 PM, ran.bi via grpc.io <
>> [email protected]> wrote:
>>
>>> What's the best way to get custom method option data (
>>> https://developers.google.com/protocol-buffers/docs/
>>> proto3#custom_options) from server interceptors?
>>>
>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/grpc-io.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/grpc-io/8756e7c5-a164-4ad3-b4d9-0d4f7b5d2239%40googlegroups.com
>>> <https://groups.google.com/d/msgid/grpc-io/8756e7c5-a164-4ad3-b4d9-0d4f7b5d2239%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/CA%2BMQGYoHUO2GYLiZn534pccDxpD6-
> dMBtEJUB0x4t1TJ9JsOJA%40mail.gmail.com
> <https://groups.google.com/d/msgid/grpc-io/CA%2BMQGYoHUO2GYLiZn534pccDxpD6-dMBtEJUB0x4t1TJ9JsOJA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2B4M1oMCDn92tL7wt-A38p7WmeT1QX04TM3PTROm518z3ywkdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to