我们从Python开源项目中,提取了以下34个代码示例,用于说明如何使用grpc.stream_stream_rpc_method_handler()。
def add_AtomicBroadcastServicer_to_server(servicer, server): rpc_method_handlers = { 'Broadcast': grpc.stream_stream_rpc_method_handler( servicer.Broadcast, request_deserializer=hfc_dot_protos_dot_common_dot_common__pb2.Envelope.FromString, response_serializer=hfc_dot_protos_dot_orderer_dot_ab__pb2.BroadcastResponse.SerializeToString, ), 'Deliver': grpc.stream_stream_rpc_method_handler( servicer.Deliver, request_deserializer=hfc_dot_protos_dot_common_dot_common__pb2.Envelope.FromString, response_serializer=hfc_dot_protos_dot_orderer_dot_ab__pb2.DeliverResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'orderer.AtomicBroadcast', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_AtomicBroadcastServicer_to_server(servicer, server): rpc_method_handlers = { 'Broadcast': grpc.stream_stream_rpc_method_handler( servicer.Broadcast, request_deserializer=hfc_dot_protos_dot_common_dot_common__pb2.Envelope.FromString, response_serializer=BroadcastResponse.SerializeToString, ), 'Deliver': grpc.stream_stream_rpc_method_handler( servicer.Deliver, request_deserializer=hfc_dot_protos_dot_common_dot_common__pb2.Envelope.FromString, response_serializer=DeliverResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'orderer.AtomicBroadcast', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_TheGameServicer_to_server(servicer, server): rpc_method_handlers = { 'Game': grpc.stream_stream_rpc_method_handler( servicer.Game, request_deserializer=thegame_dot_thegame__pb2.Controls.FromString, response_serializer=thegame_dot_thegame__pb2.GameState.SerializeToString, ), 'View': grpc.unary_stream_rpc_method_handler( servicer.View, request_deserializer=thegame_dot_thegame__pb2.ViewRequest.FromString, response_serializer=thegame_dot_thegame__pb2.GameState.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'TheGame', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_TheGameServicer_to_server(servicer, server): rpc_method_handlers = { 'Game': grpc.stream_stream_rpc_method_handler( servicer.Game, request_deserializer=Controls.FromString, response_serializer=GameState.SerializeToString, ), 'View': grpc.unary_stream_rpc_method_handler( servicer.View, request_deserializer=ViewRequest.FromString, response_serializer=GameState.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'TheGame', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_AtomicBroadcastServicer_to_server(servicer, server): rpc_method_handlers = { 'Broadcast': grpc.stream_stream_rpc_method_handler( servicer.Broadcast, request_deserializer=common_dot_common__pb2.Envelope.FromString, response_serializer=orderer_dot_ab__pb2.BroadcastResponse.SerializeToString, ), 'Deliver': grpc.stream_stream_rpc_method_handler( servicer.Deliver, request_deserializer=common_dot_common__pb2.Envelope.FromString, response_serializer=orderer_dot_ab__pb2.DeliverResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'orderer.AtomicBroadcast', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_AtomicBroadcastServicer_to_server(servicer, server): rpc_method_handlers = { 'Broadcast': grpc.stream_stream_rpc_method_handler( servicer.Broadcast, request_deserializer=common_dot_common__pb2.Envelope.FromString, response_serializer=BroadcastResponse.SerializeToString, ), 'Deliver': grpc.stream_stream_rpc_method_handler( servicer.Deliver, request_deserializer=common_dot_common__pb2.Envelope.FromString, response_serializer=DeliverResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'orderer.AtomicBroadcast', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_EventsServicer_to_server(servicer, server): rpc_method_handlers = { 'Chat': grpc.stream_stream_rpc_method_handler( servicer.Chat, request_deserializer=hfc_dot_protos_dot_peer_dot_events__pb2.SignedEvent.FromString, response_serializer=hfc_dot_protos_dot_peer_dot_events__pb2.Event.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'protos.Events', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_EventsServicer_to_server(servicer, server): rpc_method_handlers = { 'Chat': grpc.stream_stream_rpc_method_handler( servicer.Chat, request_deserializer=SignedEvent.FromString, response_serializer=Event.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'protos.Events', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_HelloServicer_to_server(servicer, server): rpc_method_handlers = { 'Greeter': grpc.unary_unary_rpc_method_handler( servicer.Greeter, request_deserializer=hello__pb2.HelloRequest.FromString, response_serializer=hello__pb2.HelloResponse.SerializeToString, ), 'GreeterResponseStream': grpc.unary_stream_rpc_method_handler( servicer.GreeterResponseStream, request_deserializer=hello__pb2.HelloRequest.FromString, response_serializer=hello__pb2.HelloResponse.SerializeToString, ), 'StreamGreeter': grpc.stream_unary_rpc_method_handler( servicer.StreamGreeter, request_deserializer=hello__pb2.HelloRequest.FromString, response_serializer=hello__pb2.HelloResponse.SerializeToString, ), 'StreamGreeterResponseStream': grpc.stream_stream_rpc_method_handler( servicer.StreamGreeterResponseStream, request_deserializer=hello__pb2.HelloRequest.FromString, response_serializer=hello__pb2.HelloResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'grpcresolver.hello.Hello', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_HelloServicer_to_server(servicer, server): rpc_method_handlers = { 'Greeter': grpc.unary_unary_rpc_method_handler( servicer.Greeter, request_deserializer=HelloRequest.FromString, response_serializer=HelloResponse.SerializeToString, ), 'GreeterResponseStream': grpc.unary_stream_rpc_method_handler( servicer.GreeterResponseStream, request_deserializer=HelloRequest.FromString, response_serializer=HelloResponse.SerializeToString, ), 'StreamGreeter': grpc.stream_unary_rpc_method_handler( servicer.StreamGreeter, request_deserializer=HelloRequest.FromString, response_serializer=HelloResponse.SerializeToString, ), 'StreamGreeterResponseStream': grpc.stream_stream_rpc_method_handler( servicer.StreamGreeterResponseStream, request_deserializer=HelloRequest.FromString, response_serializer=HelloResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'grpcresolver.hello.Hello', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_RouteGuideServicer_to_server(servicer, server): rpc_method_handlers = { 'GetFeature': grpc.unary_unary_rpc_method_handler( servicer.GetFeature, request_deserializer=Point.FromString, response_serializer=Feature.SerializeToString, ), 'ListFeatures': grpc.unary_stream_rpc_method_handler( servicer.ListFeatures, request_deserializer=Rectangle.FromString, response_serializer=Feature.SerializeToString, ), 'RecordRoute': grpc.stream_unary_rpc_method_handler( servicer.RecordRoute, request_deserializer=Point.FromString, response_serializer=RouteSummary.SerializeToString, ), 'RouteChat': grpc.stream_stream_rpc_method_handler( servicer.RouteChat, request_deserializer=RouteNote.FromString, response_serializer=RouteNote.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'routeguide.RouteGuide', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_RemotingServicer_to_server(servicer, server): rpc_method_handlers = { 'Receive': grpc.stream_stream_rpc_method_handler( servicer.Receive, request_deserializer=protos__remote__pb2.MessageBatch.FromString, response_serializer=protos__remote__pb2.Unit.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'remote.Remoting', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_RemotingServicer_to_server(servicer, server): rpc_method_handlers = { 'Receive': grpc.stream_stream_rpc_method_handler( servicer.Receive, request_deserializer=MessageBatch.FromString, response_serializer=Unit.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'remote.Remoting', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_BridgeServicer_to_server(servicer, server): rpc_method_handlers = { 'Init': grpc.unary_unary_rpc_method_handler( servicer.Init, request_deserializer=NullMessage.FromString, response_serializer=NullMessage.SerializeToString, ), 'Run': grpc.stream_stream_rpc_method_handler( servicer.Run, request_deserializer=Item.FromString, response_serializer=Item.SerializeToString, ), 'SetX': grpc.unary_unary_rpc_method_handler( servicer.SetX, request_deserializer=X.FromString, response_serializer=NullMessage.SerializeToString, ), 'StoreMetric': grpc.stream_unary_rpc_method_handler( servicer.StoreMetric, request_deserializer=Item.FromString, response_serializer=NullMessage.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'Bridge', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_BridgeServicer_to_server(servicer, server): rpc_method_handlers = { 'Init': grpc.unary_unary_rpc_method_handler( servicer.Init, request_deserializer=bridge__pb2.NullMessage.FromString, response_serializer=bridge__pb2.NullMessage.SerializeToString, ), 'Run': grpc.stream_stream_rpc_method_handler( servicer.Run, request_deserializer=bridge__pb2.Item.FromString, response_serializer=bridge__pb2.Item.SerializeToString, ), 'SetX': grpc.unary_unary_rpc_method_handler( servicer.SetX, request_deserializer=bridge__pb2.X.FromString, response_serializer=bridge__pb2.NullMessage.SerializeToString, ), 'StoreMetric': grpc.stream_unary_rpc_method_handler( servicer.StoreMetric, request_deserializer=bridge__pb2.Item.FromString, response_serializer=bridge__pb2.NullMessage.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'Bridge', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_StreamCollectorServicer_to_server(servicer, server): rpc_method_handlers = { 'StreamMetrics': grpc.stream_stream_rpc_method_handler( servicer.StreamMetrics, request_deserializer=CollectArg.FromString, response_serializer=CollectReply.SerializeToString, ), 'GetMetricTypes': grpc.unary_unary_rpc_method_handler( servicer.GetMetricTypes, request_deserializer=GetMetricTypesArg.FromString, response_serializer=MetricsReply.SerializeToString, ), 'Ping': grpc.unary_unary_rpc_method_handler( servicer.Ping, request_deserializer=Empty.FromString, response_serializer=ErrReply.SerializeToString, ), 'Kill': grpc.unary_unary_rpc_method_handler( servicer.Kill, request_deserializer=KillArg.FromString, response_serializer=ErrReply.SerializeToString, ), 'GetConfigPolicy': grpc.unary_unary_rpc_method_handler( servicer.GetConfigPolicy, request_deserializer=Empty.FromString, response_serializer=GetConfigPolicyReply.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'rpc.StreamCollector', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_WatchServicer_to_server(servicer, server): rpc_method_handlers = { 'Watch': grpc.stream_stream_rpc_method_handler( servicer.Watch, request_deserializer=WatchRequest.FromString, response_serializer=WatchResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'etcdserverpb.Watch', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_LeaseServicer_to_server(servicer, server): rpc_method_handlers = { 'LeaseGrant': grpc.unary_unary_rpc_method_handler( servicer.LeaseGrant, request_deserializer=LeaseGrantRequest.FromString, response_serializer=LeaseGrantResponse.SerializeToString, ), 'LeaseRevoke': grpc.unary_unary_rpc_method_handler( servicer.LeaseRevoke, request_deserializer=LeaseRevokeRequest.FromString, response_serializer=LeaseRevokeResponse.SerializeToString, ), 'LeaseKeepAlive': grpc.stream_stream_rpc_method_handler( servicer.LeaseKeepAlive, request_deserializer=LeaseKeepAliveRequest.FromString, response_serializer=LeaseKeepAliveResponse.SerializeToString, ), 'LeaseTimeToLive': grpc.unary_unary_rpc_method_handler( servicer.LeaseTimeToLive, request_deserializer=LeaseTimeToLiveRequest.FromString, response_serializer=LeaseTimeToLiveResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'etcdserverpb.Lease', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_EmbeddedAssistantServicer_to_server(servicer, server): rpc_method_handlers = { 'Assist': grpc.stream_stream_rpc_method_handler( servicer.Assist, request_deserializer=google_dot_assistant_dot_embedded_dot_v1alpha2_dot_embedded__assistant__pb2.AssistRequest.FromString, response_serializer=google_dot_assistant_dot_embedded_dot_v1alpha2_dot_embedded__assistant__pb2.AssistResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'google.assistant.embedded.v1alpha2.EmbeddedAssistant', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_EmbeddedAssistantServicer_to_server(servicer, server): rpc_method_handlers = { 'Converse': grpc.stream_stream_rpc_method_handler( servicer.Converse, request_deserializer=google_dot_assistant_dot_embedded_dot_v1alpha1_dot_embedded__assistant__pb2.ConverseRequest.FromString, response_serializer=google_dot_assistant_dot_embedded_dot_v1alpha1_dot_embedded__assistant__pb2.ConverseResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'google.assistant.embedded.v1alpha1.EmbeddedAssistant', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_WatchServicer_to_server(servicer, server): rpc_method_handlers = { 'Watch': grpc.stream_stream_rpc_method_handler( servicer.Watch, request_deserializer=rpc__pb2.WatchRequest.FromString, response_serializer=rpc__pb2.WatchResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'etcdserverpb.Watch', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_LeaseServicer_to_server(servicer, server): rpc_method_handlers = { 'LeaseGrant': grpc.unary_unary_rpc_method_handler( servicer.LeaseGrant, request_deserializer=rpc__pb2.LeaseGrantRequest.FromString, response_serializer=rpc__pb2.LeaseGrantResponse.SerializeToString, ), 'LeaseRevoke': grpc.unary_unary_rpc_method_handler( servicer.LeaseRevoke, request_deserializer=rpc__pb2.LeaseRevokeRequest.FromString, response_serializer=rpc__pb2.LeaseRevokeResponse.SerializeToString, ), 'LeaseKeepAlive': grpc.stream_stream_rpc_method_handler( servicer.LeaseKeepAlive, request_deserializer=rpc__pb2.LeaseKeepAliveRequest.FromString, response_serializer=rpc__pb2.LeaseKeepAliveResponse.SerializeToString, ), 'LeaseTimeToLive': grpc.unary_unary_rpc_method_handler( servicer.LeaseTimeToLive, request_deserializer=rpc__pb2.LeaseTimeToLiveRequest.FromString, response_serializer=rpc__pb2.LeaseTimeToLiveResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'etcdserverpb.Lease', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_EventsServicer_to_server(servicer, server): rpc_method_handlers = { 'Chat': grpc.stream_stream_rpc_method_handler( servicer.Chat, request_deserializer=peer_dot_events__pb2.Event.FromString, response_serializer=peer_dot_events__pb2.Event.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'protos.Events', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_ChaincodeSupportServicer_to_server(servicer, server): rpc_method_handlers = { 'Register': grpc.stream_stream_rpc_method_handler( servicer.Register, request_deserializer=ChaincodeMessage.FromString, response_serializer=ChaincodeMessage.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'protos.ChaincodeSupport', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_ChaincodeSupportServicer_to_server(servicer, server): rpc_method_handlers = { 'Register': grpc.stream_stream_rpc_method_handler( servicer.Register, request_deserializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString, response_serializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'protos.ChaincodeSupport', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_StoreServicer_to_server(servicer, server): rpc_method_handlers = { 'AddItem': grpc.unary_unary_rpc_method_handler( servicer.AddItem, request_deserializer=AddItemRequest.FromString, response_serializer=Empty.SerializeToString, ), 'AddItems': grpc.stream_unary_rpc_method_handler( servicer.AddItems, request_deserializer=AddItemRequest.FromString, response_serializer=Empty.SerializeToString, ), 'RemoveItem': grpc.unary_unary_rpc_method_handler( servicer.RemoveItem, request_deserializer=RemoveItemRequest.FromString, response_serializer=RemoveItemResponse.SerializeToString, ), 'RemoveItems': grpc.stream_unary_rpc_method_handler( servicer.RemoveItems, request_deserializer=RemoveItemRequest.FromString, response_serializer=RemoveItemResponse.SerializeToString, ), 'ListInventory': grpc.unary_stream_rpc_method_handler( servicer.ListInventory, request_deserializer=Empty.FromString, response_serializer=QuantityResponse.SerializeToString, ), 'QueryQuantity': grpc.unary_unary_rpc_method_handler( servicer.QueryQuantity, request_deserializer=QueryItemRequest.FromString, response_serializer=QuantityResponse.SerializeToString, ), 'QueryQuantities': grpc.stream_stream_rpc_method_handler( servicer.QueryQuantities, request_deserializer=QueryItemRequest.FromString, response_serializer=QuantityResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'store.Store', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_StoreServicer_to_server(servicer, server): rpc_method_handlers = { 'AddItem': grpc.unary_unary_rpc_method_handler( servicer.AddItem, request_deserializer=store__pb2.AddItemRequest.FromString, response_serializer=store__pb2.Empty.SerializeToString, ), 'AddItems': grpc.stream_unary_rpc_method_handler( servicer.AddItems, request_deserializer=store__pb2.AddItemRequest.FromString, response_serializer=store__pb2.Empty.SerializeToString, ), 'RemoveItem': grpc.unary_unary_rpc_method_handler( servicer.RemoveItem, request_deserializer=store__pb2.RemoveItemRequest.FromString, response_serializer=store__pb2.RemoveItemResponse.SerializeToString, ), 'RemoveItems': grpc.stream_unary_rpc_method_handler( servicer.RemoveItems, request_deserializer=store__pb2.RemoveItemRequest.FromString, response_serializer=store__pb2.RemoveItemResponse.SerializeToString, ), 'ListInventory': grpc.unary_stream_rpc_method_handler( servicer.ListInventory, request_deserializer=store__pb2.Empty.FromString, response_serializer=store__pb2.QuantityResponse.SerializeToString, ), 'QueryQuantity': grpc.unary_unary_rpc_method_handler( servicer.QueryQuantity, request_deserializer=store__pb2.QueryItemRequest.FromString, response_serializer=store__pb2.QuantityResponse.SerializeToString, ), 'QueryQuantities': grpc.stream_stream_rpc_method_handler( servicer.QueryQuantities, request_deserializer=store__pb2.QueryItemRequest.FromString, response_serializer=store__pb2.QuantityResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'store.Store', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_RouteGuideServicer_to_server(servicer, server): rpc_method_handlers = { 'GetFeature': grpc.unary_unary_rpc_method_handler( servicer.GetFeature, request_deserializer=route__guide__pb2.Point.FromString, response_serializer=route__guide__pb2.Feature.SerializeToString, ), 'ListFeatures': grpc.unary_stream_rpc_method_handler( servicer.ListFeatures, request_deserializer=route__guide__pb2.Rectangle.FromString, response_serializer=route__guide__pb2.Feature.SerializeToString, ), 'RecordRoute': grpc.stream_unary_rpc_method_handler( servicer.RecordRoute, request_deserializer=route__guide__pb2.Point.FromString, response_serializer=route__guide__pb2.RouteSummary.SerializeToString, ), 'RouteChat': grpc.stream_stream_rpc_method_handler( servicer.RouteChat, request_deserializer=route__guide__pb2.RouteNote.FromString, response_serializer=route__guide__pb2.RouteNote.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'routeguide.RouteGuide', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_TestServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'NormalMethod': grpc.unary_unary_rpc_method_handler( servicer.NormalMethod, request_deserializer=service__pb2.StandardRequest.FromString, response_serializer=service__pb2.StandardReply.SerializeToString, ), 'StreamMethod': grpc.unary_stream_rpc_method_handler( servicer.StreamMethod, request_deserializer=service__pb2.StreamRequest.FromString, response_serializer=service__pb2.StandardReply.SerializeToString, ), 'StreamInputMethod': grpc.stream_unary_rpc_method_handler( servicer.StreamInputMethod, request_deserializer=service__pb2.StandardRequest.FromString, response_serializer=service__pb2.StreamReply.SerializeToString, ), 'StreamStreamMethod': grpc.stream_stream_rpc_method_handler( servicer.StreamStreamMethod, request_deserializer=service__pb2.StandardRequest.FromString, response_serializer=service__pb2.StandardReply.SerializeToString, ), 'DelayedMethod': grpc.unary_unary_rpc_method_handler( servicer.DelayedMethod, request_deserializer=service__pb2.StandardRequest.FromString, response_serializer=service__pb2.StandardReply.SerializeToString, ), 'ExceptionMethod': grpc.unary_unary_rpc_method_handler( servicer.ExceptionMethod, request_deserializer=service__pb2.StandardRequest.FromString, response_serializer=service__pb2.StandardReply.SerializeToString, ), 'DelayedStream': grpc.unary_stream_rpc_method_handler( servicer.DelayedStream, request_deserializer=service__pb2.StreamRequest.FromString, response_serializer=service__pb2.StandardReply.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'TestService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))
def add_TestServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'NormalMethod': grpc.unary_unary_rpc_method_handler( servicer.NormalMethod, request_deserializer=StandardRequest.FromString, response_serializer=StandardReply.SerializeToString, ), 'StreamMethod': grpc.unary_stream_rpc_method_handler( servicer.StreamMethod, request_deserializer=StreamRequest.FromString, response_serializer=StandardReply.SerializeToString, ), 'StreamInputMethod': grpc.stream_unary_rpc_method_handler( servicer.StreamInputMethod, request_deserializer=StandardRequest.FromString, response_serializer=StreamReply.SerializeToString, ), 'StreamStreamMethod': grpc.stream_stream_rpc_method_handler( servicer.StreamStreamMethod, request_deserializer=StandardRequest.FromString, response_serializer=StandardReply.SerializeToString, ), 'DelayedMethod': grpc.unary_unary_rpc_method_handler( servicer.DelayedMethod, request_deserializer=StandardRequest.FromString, response_serializer=StandardReply.SerializeToString, ), 'ExceptionMethod': grpc.unary_unary_rpc_method_handler( servicer.ExceptionMethod, request_deserializer=StandardRequest.FromString, response_serializer=StandardReply.SerializeToString, ), 'DelayedStream': grpc.unary_stream_rpc_method_handler( servicer.DelayedStream, request_deserializer=StreamRequest.FromString, response_serializer=StandardReply.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'TestService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,))