We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我在生产者产生的消息推送到rabbitmq上(我指定了队列名),此时消费者尚未消费,但是在界面的rabbitmq后台获取不了消息。先运行消费者程序就能够正常获取到消息。
# 生产者代码 import pika import sys credentials = pika.PlainCredentials('admin', 'admin') # mq用户名和密码 # 虚拟队列需要指定参数 virtual_host,如果是默认的可以不填。 connection = pika.BlockingConnection(pika.ConnectionParameters(host='127.0.0.1', port=5672, virtual_host='rabbitmq', credentials=credentials)) channel = connection.channel() channel.queue_declare(queue='wx_message', durable=False) # channel.queue_bind(exchange='direct_logs', # queue='wx_message') # 声明一个名为direct_logs的direct类型的exchange # direct类型的exchange channel.exchange_declare(exchange='direct_logs', exchange_type='direct') # 从命令行获取basic_publish的配置参数 severity = sys.argv[1] if len(sys.argv) > 1 else 'info' message = ' '.join(sys.argv[2:]) or 'Hello World!' # 向名为direct_logs的exchage按照设置的routing_key发送message channel.basic_publish(exchange='direct_logs', routing_key=severity, body=message ) print(" [x] Sent %r:%r" % (severity, message)) connection.close()
在wx_message队列里面并没有获取消息,请问这是什么原因?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我在生产者产生的消息推送到rabbitmq上(我指定了队列名),此时消费者尚未消费,但是在界面的rabbitmq后台获取不了消息。先运行消费者程序就能够正常获取到消息。
在wx_message队列里面并没有获取消息,请问这是什么原因?
The text was updated successfully, but these errors were encountered: