mirror of
https://github.com/php-win-ext/grpc.git
synced 2026-03-25 09:32:14 +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. ```
31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
# source: helloworld.proto
|
|
"""Generated protocol buffer code."""
|
|
from google.protobuf.internal import builder as _builder
|
|
from google.protobuf import descriptor as _descriptor
|
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
from google.protobuf import symbol_database as _symbol_database
|
|
# @@protoc_insertion_point(imports)
|
|
|
|
_sym_db = _symbol_database.Default()
|
|
|
|
|
|
|
|
|
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10helloworld.proto\x12\nhelloworld\"\x1c\n\x0cHelloRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x1d\n\nHelloReply\x12\x0f\n\x07message\x18\x01 \x01(\t2I\n\x07Greeter\x12>\n\x08SayHello\x12\x18.helloworld.HelloRequest\x1a\x16.helloworld.HelloReply\"\x00\x42\x36\n\x1bio.grpc.examples.helloworldB\x0fHelloWorldProtoP\x01\xa2\x02\x03HLWb\x06proto3')
|
|
|
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'helloworld_pb2', globals())
|
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
|
|
DESCRIPTOR._options = None
|
|
DESCRIPTOR._serialized_options = b'\n\033io.grpc.examples.helloworldB\017HelloWorldProtoP\001\242\002\003HLW'
|
|
_HELLOREQUEST._serialized_start=32
|
|
_HELLOREQUEST._serialized_end=60
|
|
_HELLOREPLY._serialized_start=62
|
|
_HELLOREPLY._serialized_end=91
|
|
_GREETER._serialized_start=93
|
|
_GREETER._serialized_end=166
|
|
# @@protoc_insertion_point(module_scope)
|