赞
踩
- import pika
-
-
- class ConsumerMq:
- def __init__(self, host="ip", port='port', username="username", password="pwd"):
- self.connection = pika.BlockingConnection(
- pika.ConnectionParameters(
- host=host,
- port=port,
- heartbeat=None,
- credentials=pika.credentials.PlainCredentials(username=username, password=password),
- )
- )
- self.channel = self.connection.channel()
-
- self.queue = self.channel.queue_declare(queue="开始查询_自用")
- print(self.queue.method.message_count)
-
- ConsumerMq()
核心代码为:
print(self.queue.method.message_count)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。