本文整理汇总了Python中system.process_context.ProcessContext.get_queue方法的典型用法代码示例。如果您正苦于以下问题:Python ProcessContext.get_queue方法的具体用法?Python ProcessContext.get_queue怎么用?Python ProcessContext.get_queue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类system.process_context.ProcessContext
的用法示例。
在下文中一共展示了ProcessContext.get_queue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: purge_mq_queue
# 需要导入模块: from system.process_context import ProcessContext [as 别名]
# 或者: from system.process_context.ProcessContext import get_queue [as 别名]
from system.process_context import ProcessContext
from tests.base_fixtures import get_field_starting_with
def purge_mq_queue(mq_queue_name):
conn = Connection()
chan = conn.connection.channel()
try:
n = chan.queue_purge(mq_queue_name)
print "Purged %s messages from %s queue" % (n, mq_queue_name)
except Exception:
print "Unable to purge %s" % mq_queue_name
chan.close()
conn.close()
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage 1 - to purge specific queue:\n\tpython purge_queue.py queue_name\n"
print "Usage 2 - to purge all Synergy queues:\n\tpython purge_queue.py all\n"
sys.exit(0)
if sys.argv[1] == 'all':
processes = get_field_starting_with('PROCESS_', process_context)
for process_name in processes:
mq_queue_name = ProcessContext.get_queue(process_name)
purge_mq_queue(mq_queue_name)
else:
mq_queue_name = sys.argv[1]
purge_mq_queue(mq_queue_name)
示例2: __init__
# 需要导入模块: from system.process_context import ProcessContext [as 别名]
# 或者: from system.process_context.ProcessContext import get_queue [as 别名]
def __init__(self, process_name):
self.routing_key = ProcessContext.get_routing(process_name)
self.exchange = ProcessContext.get_exchange(process_name)
self.queue = ProcessContext.get_queue(process_name)