RabbitMQ管理7

2022-04-23 19:00:55 浏览数 (1)

再次测试发送

代码语言:javascript复制
[root@h102 python]# python p.py 
 [x] Sent 'Hello World!'
[root@h102 python]# echo $?
0
[root@h102 python]#

查看队列

代码语言:javascript复制
[root@h102 python]# rabbitmqctl list_queues
Listing queues ...
mq_learning_q	1
[root@h102 python]# 

消费队列里的内容(这个进程消费完队列里的内容后,会挂起,等待接收队列里新的内容)

代码语言:javascript复制
[root@h102 python]# python c.py 
 [*] Waiting for messages. To exit press CTRL C
 [x] Received 'Hello World!'

Tip: 尝试多发几次,可以在消费端不断看到新的内容

代码语言:javascript复制
[root@h102 python]# python p.py 
 [x] Sent 'Hello World!'
[root@h102 python]# python p.py 
 [x] Sent 'Hello World!'
[root@h102 python]# python p.py 
 [x] Sent 'Hello World!'
[root@h102 python]# python p.py 
 [x] Sent 'Hello World!'
[root@h102 python]# python p.py 
 [x] Sent 'Hello World!'
[root@h102 python]# 
----------
[root@h102 python]# python c.py 
 [*] Waiting for messages. To exit press CTRL C
 [x] Received 'Hello World!'
 [x] Received 'Hello World!'
 [x] Received 'Hello World!'
 [x] Received 'Hello World!'
 [x] Received 'Hello World!'
 [x] Received 'Hello World!'

0 人点赞