当前位置: 首页>>代码示例>>Python>>正文


Python MessageController.subscriptions方法代码示例

本文整理汇总了Python中ovs.lib.messaging.MessageController.subscriptions方法的典型用法代码示例。如果您正苦于以下问题:Python MessageController.subscriptions方法的具体用法?Python MessageController.subscriptions怎么用?Python MessageController.subscriptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ovs.lib.messaging.MessageController的用法示例。


在下文中一共展示了MessageController.subscriptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: retrieve

# 需要导入模块: from ovs.lib.messaging import MessageController [as 别名]
# 或者: from ovs.lib.messaging.MessageController import subscriptions [as 别名]
 def retrieve(self, pk):
     """
     Retrieves the subscriptions for a given subscriber
     """
     try:
         pk = int(pk)
     except (ValueError, TypeError):
         return Response(status=status.HTTP_400_BAD_REQUEST)
     return Response(MessageController.subscriptions(pk), status=status.HTTP_200_OK)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:11,代码来源:messaging.py

示例2: wait

# 需要导入模块: from ovs.lib.messaging import MessageController [as 别名]
# 或者: from ovs.lib.messaging.MessageController import subscriptions [as 别名]
 def wait(self, pk, message_id):
     """
     Wait for messages to appear for a given subscriber
     """
     try:
         pk = int(pk)
         message_id = int(message_id)
     except (ValueError, TypeError):
         return Response(status=status.HTTP_400_BAD_REQUEST)
     thread = gevent.spawn(MessagingViewSet._wait, pk, message_id)
     gevent.joinall([thread])
     messages, last_message_id = thread.value
     return Response({'messages'       : messages,
                      'last_message_id': last_message_id,
                      'subscriptions'  : MessageController.subscriptions(pk)}, status=status.HTTP_200_OK)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:17,代码来源:messaging.py

示例3: wait

# 需要导入模块: from ovs.lib.messaging import MessageController [as 别名]
# 或者: from ovs.lib.messaging.MessageController import subscriptions [as 别名]
 def wait(self, pk, message_id):
     """
     Wait for messages to appear for a given subscriber
     :param pk: Primary key of subscriber
     :type pk: int
     :param message_id: The last message_id that was already received
     :type message_id: str
     """
     try:
         pk = int(pk)
         message_id = int(message_id)
     except (ValueError, TypeError):
         return Response(status=status.HTTP_400_BAD_REQUEST)
     thread = gevent.spawn(MessagingViewSet._wait, pk, message_id)
     gevent.joinall([thread])
     result = thread.value
     if result is None:
         messages = []
         last_message_id = message_id
     else:
         messages, last_message_id = thread.value
     return Response({'messages': messages,
                      'last_message_id': last_message_id,
                      'subscriptions': MessageController.subscriptions(pk)}, status=status.HTTP_200_OK)
开发者ID:grimpy,项目名称:openvstorage,代码行数:26,代码来源:messaging.py


注:本文中的ovs.lib.messaging.MessageController.subscriptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。