On Fri, Sep 15, 2017 at 7:03 AM, Evan Jones <[email protected]> wrote:

> I think the only real additional information is from reading the
> implementation.
>

While reading the implementation should be helpful, I'd like to think that
our generated-from-doc-strings API documentation is complete? As long as
you're reading code, I'd recommend also reading the tests as well as the
implementation; many of the tests are written as users of the generic API.
Oh, and since the code generated by gRPC Python Protoc Plug-In that
provides a customized API to applications is also *itself* a user of the
generic API, reading the generated _pb2_grpc.py file would likely also be
helpful.

Its fairly simple: in _server.py, the _ServerState object holds on to a
> list of handlers. When a request comes in, _find_method_handler is called,
> which calls the GenericRpcHandler.service() method for each of the handlers
> in order, until one of them returns a value. It then uses that method
> handler to handle the request.
>
> That said: I'm not sure why you might want to mess with this, since if you
> are using generated protocol buffer stubs, it should handle this for you.
> The reason I've dug through this is we have a fairly silly unit test to
> make sure our application has registered for the correct RPCs after it is
> initialized, since we had a bug where some but not all the handlers were
> registered after refactoring some code.
>

Our expectation is that working with Protocol Buffers will be the foremost
use case, especially for beginners, and that the generic API will only be
used by a few advanced users. That's why even though it's there there are
not examples or tutorials working with it.

On Thursday, September 14, 2017 at 4:22:27 AM UTC-4, Amit Saha wrote:
>>
>> https://grpc.io/grpc/python/grpc.html#grpc.server mentions the handlers
>> kwarg to be "An optional list of GenericRpcHandlers used for executing
>> RPCs.".
>>
>> Is there more information on this?
>>
>
On the very same page did you also see the specifications for
grpc.GenericRpcHandler
<https://grpc.io/grpc/python/grpc.html#grpc.GenericRpcHandler>,
grpc.HandlerCallDetails
<https://grpc.io/grpc/python/grpc.html#grpc.HandlerCallDetails>, and
grpc.MethodCallHandler
<https://grpc.io/grpc/python/grpc.html#grpc.RpcMethodHandler>?
-Nathaniel

-- 
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/CAEOYnAT%2BWKvD0O080XMH-djGD-pW3Erzv84RwyB5xSaDeq7rVA%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