RabbitMQ管理5

2022-04-23 18:58:49 浏览数 (1)

/ 也是可以被删除的

代码语言:javascript复制
[root@h101 ~]# rabbitmqctl list_vhosts
Listing vhosts ...
/
[root@h101 ~]# rabbitmqctl delete_vhost /
Deleting vhost "/" ...
[root@h101 ~]# rabbitmqctl list_vhosts
Listing vhosts ...
[root@h101 ~]#

连接RabbitMQ

python连接RabbitMQ

python连接RabbitMQ

生产脚本

代码语言:javascript复制
[root@h102 python]# cat p.py 
#!/usr/bin/env python
import pika

connection = pika.BlockingConnection(pika.ConnectionParameters(
        host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='mq_learning_q')

channel.basic_publish(exchange='',
                      routing_key='mq_learning_q',
                      body='Hello World!')
print " [x] Sent 'Hello World!'"
connection.close()
[root@h102 python]# 

0 人点赞