本文整理汇总了Python中pyon.net.endpoint.Subscriber.get_stats方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.get_stats方法的具体用法?Python Subscriber.get_stats怎么用?Python Subscriber.get_stats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.net.endpoint.Subscriber
的用法示例。
在下文中一共展示了Subscriber.get_stats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_realtime_visualization_data
# 需要导入模块: from pyon.net.endpoint import Subscriber [as 别名]
# 或者: from pyon.net.endpoint.Subscriber import get_stats [as 别名]
def get_realtime_visualization_data(self, query_token=''):
"""This operation returns a block of visualization data for displaying data product in real time. This operation requires a
user specific token which was provided from a previsou request to the init_realtime_visualization operation.
@param query_token str
@retval datatable str
@throws NotFound Throws if specified query_token or its visualization product does not exist
"""
if not query_token:
raise BadRequest("The query_token parameter is missing")
try:
#Taking advantage of idempotency
xq = self.container.ex_manager.create_xn_queue(query_token)
subscriber = Subscriber(from_name=xq)
subscriber.initialize()
msg_count,_ = subscriber.get_stats()
log.info('Messages in user queue 1: %s ' % msg_count)
ret_val = []
msgs = subscriber.get_all_msgs(timeout=2)
for x in range(len(msgs)):
msgs[x].ack()
# Different messages should get processed differently. Ret val will be decided by the viz product type
ret_val = self._process_visualization_message(msgs)
msg_count,_ = subscriber.get_stats()
log.info('Messages in user queue 2: %s ' % msg_count)
except Exception, e:
raise e