本文整理汇总了Python中grpc.stream_stream_rpc_method_handler方法的典型用法代码示例。如果您正苦于以下问题:Python grpc.stream_stream_rpc_method_handler方法的具体用法?Python grpc.stream_stream_rpc_method_handler怎么用?Python grpc.stream_stream_rpc_method_handler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grpc
的用法示例。
在下文中一共展示了grpc.stream_stream_rpc_method_handler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_pcoccNodeServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_pcoccNodeServicer_to_server(servicer, server):
rpc_method_handlers = {
'route_command': grpc.unary_unary_rpc_method_handler(
servicer.route_command,
request_deserializer=agent__pb2.RouteMessage.FromString,
response_serializer=agent__pb2.RouteMessageResult.SerializeToString,
),
'route_stream': grpc.stream_stream_rpc_method_handler(
servicer.route_stream,
request_deserializer=agent__pb2.McastMessage.FromString,
response_serializer=agent__pb2.RouteMessageResult.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'pcoccNode', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例2: add_RibApiServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_RibApiServicer_to_server(servicer, server):
rpc_method_handlers = {
'Modify': grpc.stream_stream_rpc_method_handler(
servicer.Modify,
request_deserializer=nokia__rib__api__pb2.ModifyRequest.FromString,
response_serializer=nokia__rib__api__pb2.ModifyResponse.SerializeToString,
),
'GetVersion': grpc.unary_unary_rpc_method_handler(
servicer.GetVersion,
request_deserializer=nokia__rib__api__pb2.VersionRequest.FromString,
response_serializer=nokia__rib__api__pb2.VersionResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Nokia.SROS.RibApi', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例3: add_SpeechServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_SpeechServicer_to_server(servicer, server):
rpc_method_handlers = {
'Recognize': grpc.unary_unary_rpc_method_handler(
servicer.Recognize,
request_deserializer=speech__pb2.RecognizeRequest.FromString,
response_serializer=speech__pb2.RecognizeResponse.SerializeToString,
),
'StreamingRecognize': grpc.stream_stream_rpc_method_handler(
servicer.StreamingRecognize,
request_deserializer=speech__pb2.StreamingRecognizeRequest.FromString,
response_serializer=speech__pb2.StreamingRecognizeResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'parlance.patter.speech.v1.Speech', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例4: add_ClusterServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_ClusterServicer_to_server(servicer, server):
rpc_method_handlers = {
'Submit': grpc.stream_stream_rpc_method_handler(
servicer.Submit,
request_deserializer=hfc_dot_protos_dot_orderer_dot_cluster__pb2.SubmitRequest.FromString,
response_serializer=hfc_dot_protos_dot_orderer_dot_cluster__pb2.SubmitResponse.SerializeToString,
),
'Step': grpc.unary_unary_rpc_method_handler(
servicer.Step,
request_deserializer=hfc_dot_protos_dot_orderer_dot_cluster__pb2.StepRequest.FromString,
response_serializer=hfc_dot_protos_dot_orderer_dot_cluster__pb2.StepResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'orderer.Cluster', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例5: add_AtomicBroadcastServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
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,))
示例6: add_DeliverServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_DeliverServicer_to_server(servicer, server):
rpc_method_handlers = {
'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_peer_dot_events__pb2.DeliverResponse.SerializeToString,
),
'DeliverFiltered': grpc.stream_stream_rpc_method_handler(
servicer.DeliverFiltered,
request_deserializer=hfc_dot_protos_dot_common_dot_common__pb2.Envelope.FromString,
response_serializer=hfc_dot_protos_dot_peer_dot_events__pb2.DeliverResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'protos.Deliver', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例7: add_GossipServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_GossipServicer_to_server(servicer, server):
rpc_method_handlers = {
'GossipStream': grpc.stream_stream_rpc_method_handler(
servicer.GossipStream,
request_deserializer=hfc_dot_protos_dot_gossip_dot_message__pb2.Envelope.FromString,
response_serializer=hfc_dot_protos_dot_gossip_dot_message__pb2.Envelope.SerializeToString,
),
'Ping': grpc.unary_unary_rpc_method_handler(
servicer.Ping,
request_deserializer=hfc_dot_protos_dot_gossip_dot_message__pb2.Empty.FromString,
response_serializer=hfc_dot_protos_dot_gossip_dot_message__pb2.Empty.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'gossip.Gossip', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例8: add_SubscriberServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_SubscriberServicer_to_server(servicer, server):
rpc_method_handlers = {
'receive': grpc.unary_stream_rpc_method_handler(
servicer.receive,
request_deserializer=SubscriptionRequest.FromString,
response_serializer=Message.SerializeToString,
),
'receiveWithAcks': grpc.stream_stream_rpc_method_handler(
servicer.receiveWithAcks,
request_deserializer=SubscriptionResponse.FromString,
response_serializer=Message.SerializeToString,
),
'subscribe': grpc.stream_stream_rpc_method_handler(
servicer.subscribe,
request_deserializer=SubscriptionAcks.FromString,
response_serializer=SubscriptionMessage.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'predix.eventhub.Subscriber', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例9: add_SubscriberServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_SubscriberServicer_to_server(servicer, server):
rpc_method_handlers = {
'receive': grpc.unary_stream_rpc_method_handler(
servicer.receive,
request_deserializer=EventHub__pb2.SubscriptionRequest.FromString,
response_serializer=EventHub__pb2.Message.SerializeToString,
),
'receiveWithAcks': grpc.stream_stream_rpc_method_handler(
servicer.receiveWithAcks,
request_deserializer=EventHub__pb2.SubscriptionResponse.FromString,
response_serializer=EventHub__pb2.Message.SerializeToString,
),
'subscribe': grpc.stream_stream_rpc_method_handler(
servicer.subscribe,
request_deserializer=EventHub__pb2.SubscriptionAcks.FromString,
response_serializer=EventHub__pb2.SubscriptionMessage.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'predix.eventhub.Subscriber', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例10: add_ConnectorServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_ConnectorServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetCapabilities': grpc.unary_unary_rpc_method_handler(
servicer.GetCapabilities,
request_deserializer=Empty.FromString,
response_serializer=Capabilities.SerializeToString,
),
'ExecuteFunction': grpc.stream_stream_rpc_method_handler(
servicer.ExecuteFunction,
request_deserializer=BundledRows.FromString,
response_serializer=BundledRows.SerializeToString,
),
'EvaluateScript': grpc.stream_stream_rpc_method_handler(
servicer.EvaluateScript,
request_deserializer=BundledRows.FromString,
response_serializer=BundledRows.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'qlik.sse.Connector', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例11: add_SessionsServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_SessionsServicer_to_server(servicer, server):
rpc_method_handlers = {
"DetectIntent": grpc.unary_unary_rpc_method_handler(
servicer.DetectIntent,
request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentRequest.FromString,
response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentResponse.SerializeToString,
),
"StreamingDetectIntent": grpc.stream_stream_rpc_method_handler(
servicer.StreamingDetectIntent,
request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.FromString,
response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
"google.cloud.dialogflow.v2beta1.Sessions", rpc_method_handlers
)
server.add_generic_rpc_handlers((generic_handler,))
示例12: add_SessionsServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_SessionsServicer_to_server(servicer, server):
rpc_method_handlers = {
"DetectIntent": grpc.unary_unary_rpc_method_handler(
servicer.DetectIntent,
request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentRequest.FromString,
response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentResponse.SerializeToString,
),
"StreamingDetectIntent": grpc.stream_stream_rpc_method_handler(
servicer.StreamingDetectIntent,
request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.FromString,
response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
"google.cloud.dialogflow.v2.Sessions", rpc_method_handlers
)
server.add_generic_rpc_handlers((generic_handler,))
示例13: _wrap_rpc_behavior
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def _wrap_rpc_behavior(handler, fn):
"""Returns a new rpc handler that wraps the given function"""
if handler is None:
return None
if handler.request_streaming and handler.response_streaming:
behavior_fn = handler.stream_stream
handler_factory = grpc.stream_stream_rpc_method_handler
elif handler.request_streaming and not handler.response_streaming:
behavior_fn = handler.stream_unary
handler_factory = grpc.stream_unary_rpc_method_handler
elif not handler.request_streaming and handler.response_streaming:
behavior_fn = handler.unary_stream
handler_factory = grpc.unary_stream_rpc_method_handler
else:
behavior_fn = handler.unary_unary
handler_factory = grpc.unary_unary_rpc_method_handler
return handler_factory(
fn(behavior_fn, handler.request_streaming,
handler.response_streaming),
request_deserializer=handler.request_deserializer,
response_serializer=handler.response_serializer
)
示例14: add_TraceServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_TraceServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'Config': grpc.stream_stream_rpc_method_handler(
servicer.Config,
request_deserializer=opencensus_dot_proto_dot_agent_dot_trace_dot_v1_dot_trace__service__pb2.CurrentLibraryConfig.FromString,
response_serializer=opencensus_dot_proto_dot_agent_dot_trace_dot_v1_dot_trace__service__pb2.UpdatedLibraryConfig.SerializeToString,
),
'Export': grpc.stream_stream_rpc_method_handler(
servicer.Export,
request_deserializer=opencensus_dot_proto_dot_agent_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceRequest.FromString,
response_serializer=opencensus_dot_proto_dot_agent_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'opencensus.proto.agent.trace.v1.TraceService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例15: add_TransferServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_stream_rpc_method_handler [as 别名]
def add_TransferServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'send': grpc.stream_unary_rpc_method_handler(
servicer.send,
request_deserializer=transfer__pb2.TransferBatch.FromString,
response_serializer=transfer__pb2.TransferBatch.SerializeToString,
),
'recv': grpc.unary_stream_rpc_method_handler(
servicer.recv,
request_deserializer=transfer__pb2.TransferBatch.FromString,
response_serializer=transfer__pb2.TransferBatch.SerializeToString,
),
'sendRecv': grpc.stream_stream_rpc_method_handler(
servicer.sendRecv,
request_deserializer=transfer__pb2.TransferBatch.FromString,
response_serializer=transfer__pb2.TransferBatch.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'com.webank.eggroll.core.transfer.TransferService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))