mirror of
https://github.com/php-win-ext/grpc.git
synced 2026-03-26 01:52:16 +01:00
### Description Fix https://github.com/grpc/grpc/issues/24470. Adding one example which demonstrate the following use cases: * Generate RPC ID on client side and propagate to server. * Context propagation from client to server. * Context propagation between different server interceptors and the server handler. ## Use: 1. Start server: `python3 -m async_greeter_server_with_interceptor` 2. Start client: `python3 -m async_greeter_client` ### Expected Logs: * On client side: ``` Sending request with rpc id: 73bb98beff10c2dd7b9f2252a1e2039e Greeter client received: Hello, you! ``` * On server side: ``` INFO:root:Starting server on [::]:50051 INFO:root:Interceptor1 called with rpc_id: default INFO:root:Interceptor2 called with rpc_id: Interceptor1-default INFO:root:Handle rpc with id Interceptor2-Interceptor1-73bb98beff10c2dd7b9f2252a1e2039e in server handler. ```
18 lines
576 B
Python
18 lines
576 B
Python
from google.protobuf import descriptor as _descriptor
|
|
from google.protobuf import message as _message
|
|
from typing import ClassVar as _ClassVar, Optional as _Optional
|
|
|
|
DESCRIPTOR: _descriptor.FileDescriptor
|
|
|
|
class HelloReply(_message.Message):
|
|
__slots__ = ["message"]
|
|
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
message: str
|
|
def __init__(self, message: _Optional[str] = ...) -> None: ...
|
|
|
|
class HelloRequest(_message.Message):
|
|
__slots__ = ["name"]
|
|
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
name: str
|
|
def __init__(self, name: _Optional[str] = ...) -> None: ...
|