本文整理汇总了Python中pyon.net.endpoint.RPCResponseEndpointUnit.message_received方法的典型用法代码示例。如果您正苦于以下问题:Python RPCResponseEndpointUnit.message_received方法的具体用法?Python RPCResponseEndpointUnit.message_received怎么用?Python RPCResponseEndpointUnit.message_received使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.net.endpoint.RPCResponseEndpointUnit
的用法示例。
在下文中一共展示了RPCResponseEndpointUnit.message_received方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_message_received_dict
# 需要导入模块: from pyon.net.endpoint import RPCResponseEndpointUnit [as 别名]
# 或者: from pyon.net.endpoint.RPCResponseEndpointUnit import message_received [as 别名]
def test_message_received_dict(self):
rout_obj = Mock()
e = RPCResponseEndpointUnit(routing_obj=rout_obj)
msg_dict = {'iam':'adict'}
e.message_received(msg_dict, {'op':'anyop'})
rout_obj.anyop.assert_called_once_with(iam='adict')
示例2: test_message_received_dict
# 需要导入模块: from pyon.net.endpoint import RPCResponseEndpointUnit [as 别名]
# 或者: from pyon.net.endpoint.RPCResponseEndpointUnit import message_received [as 别名]
def test_message_received_dict(self):
rout_obj = Mock()
e = RPCResponseEndpointUnit(routing_obj=rout_obj)
msg_dict = {"iam": "adict"}
e.message_received(msg_dict, {"op": "anyop"})
rout_obj.anyop.assert_called_once_with(iam="adict")
示例3: message_received
# 需要导入模块: from pyon.net.endpoint import RPCResponseEndpointUnit [as 别名]
# 或者: from pyon.net.endpoint.RPCResponseEndpointUnit import message_received [as 别名]
def message_received(self, msg, headers):
#This is the hook for checking governance pre-conditions before calling a service operation
#TODO - replace with a process specific interceptor stack of some sort.
gc = self._routing_obj.container.governance_controller
if gc:
gc.check_process_operation_preconditions(self._routing_obj, msg, headers)
result, response_headers = RPCResponseEndpointUnit.message_received(self, msg, headers)
# decorate our response_headers with process-saturation, as we need them to be set in the headers
# earlier than send/build_header so the sampling takes notice
try:
response_headers['process-saturation'] = self._get_process_saturation()
except Exception as ex:
log.warn("Could not set process-saturation header, ignoring: %s", ex)
return result, response_headers