本文整理匯總了Python中synnefo.lib.amqp.AMQPClient.basic_ack方法的典型用法代碼示例。如果您正苦於以下問題:Python AMQPClient.basic_ack方法的具體用法?Python AMQPClient.basic_ack怎麽用?Python AMQPClient.basic_ack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類synnefo.lib.amqp.AMQPClient
的用法示例。
在下文中一共展示了AMQPClient.basic_ack方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: handle
# 需要導入模塊: from synnefo.lib.amqp import AMQPClient [as 別名]
# 或者: from synnefo.lib.amqp.AMQPClient import basic_ack [as 別名]
def handle(self, *args, **options):
if len(args) != 1:
raise CommandError("Please provide a queue")
queue = args[0]
interactive = options['interactive']
requeue = options['requeue']
client = AMQPClient()
client.connect()
pp = pprint.PrettyPrinter(indent=4, width=4)
more_msgs = True
counter = 0
sep = '-' * 80
while more_msgs:
msg = client.basic_get(queue=queue)
if msg:
counter += 1
print sep
print 'Message %d:' % counter
print sep
pp.pprint(msg)
if not requeue or interactive:
if interactive and not get_user_confirmation():
continue
# Acknowledging the message will remove it from the queue
client.basic_ack(msg)
else:
more_msgs = False