RabbitMQ不打印任何消息到控制台

时间:2019-04-11 12:30:29

标签: python rabbitmq

我正在按照文档处理rabbitmq,并且正在按照文档中指定的方式进行操作,没有错误,我运行了send.py和receive.py文件,然后运行send.py和send.py,并且未打印任何消息在控制台中。感谢您的帮助。链接到教程docs谢谢

send.py 

import pika

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

channel.queue_declare(queue='Hello')

channel.basic_publish(exchange='',
                      routing_key='hello',
                      body='Hello World!')
print(" [x] Sent 'Hello World!'")
connection.close()


receive.py 

import pika

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

channel.queue_declare(queue='Hello')

def callback(ch, method, properties, body):
    print('[x] Recieved %s' % body)


channel.basic_consume(queue='Hello', auto_ack=True, on_message_callback=callback)
print(' [*] Waiting for messages. To exit press CTRL+C')

channel.start_consuming()


logs 
crash.log
2019-04-11 16:17:52 =SUPERVISOR REPORT====
     Supervisor: {<0.443.0>,rabbit_channel_sup_sup}
     Context:    shutdown_error
     Reason:     shutdown
     Offender:   [{nb_children,1},{name,channel_sup},{mfargs,{rabbit_channel_sup,start_link,[]}},{restart_type,temporary},{shutdown,infinity},{child_type,supervisor}]

rabbit@admin-PC.log

2019-04-11 13:28:36.448 [info] <0.8.0> Log file opened with Lager
2019-04-11 13:28:37.558 [info] <0.215.0> 
 Starting RabbitMQ 3.7.14 on Erlang 21.3
 Copyright (C) 2007-2019 Pivotal Software, Inc.
 Licensed under the MPL.  See https://www.rabbitmq.com/
2019-04-11 13:28:37.558 [info] <0.215.0> 
 node           : rabbit@admin-PC
 home dir       : C:\Windows\system32\config\systemprofile
 config file(s) : c:/Users/admin/AppData/Roaming/RabbitMQ/advanced.config
 cookie hash    : A0gjH122k0i5UCJhqrPbcQ==
 log(s)         : C:/Users/admin/AppData/Roaming/RabbitMQ/log/RABBIT~1.LOG
                : C:/Users/admin/AppData/Roaming/RabbitMQ/log/rabbit@admin-PC_upgrade.log
 database dir   : c:/Users/admin/AppData/Roaming/RabbitMQ/db/RABBIT~1
2019-04-11 13:28:40.824 [info] <0.215.0> Running boot step pre_boot defined by app rabbit
2019-04-11 13:28:40.824 [info] <0.215.0> Running boot step rabbit_core_metrics defined by app rabbit
2019-04-11 13:28:40.824 [info] <0.215.0> Running boot step rabbit_alarm defined by app rabbit
2019-04-11 13:28:40.839 [info] <0.223.0> Memory high watermark set to 789 MiB (827885158 bytes) of 1973 MiB (2069712896 bytes) total
2019-04-11 13:28:41.402 [info] <0.225.0> Enabling free disk space monitoring
2019-04-11 13:28:41.402 [info] <0.225.0> Disk free limit set to 50MB
2019-04-11 13:28:41.418 [info] <0.215.0> Running boot step code_server_cache defined by app rabbit
2019-04-11 13:28:41.418 [info] <0.215.0> Running boot step file_handle_cache defined by app rabbit
2019-04-11 13:28:41.433 [info] <0.228.0> Limiting to approx 8092 file handles (7280 sockets)
2019-04-11 13:28:41.433 [info] <0.229.0> FHC read buffering:  OFF
2019-04-11 13:28:41.433 [info] <0.229.0> FHC write buffering: ON
2019-04-11 13:28:41.433 [info] <0.215.0> Running boot step worker_pool defined by app rabbit
2019-04-11 13:28:41.433 [info] <0.215.0> Running boot step database defined by app rabbit
2019-04-11 13:28:41.433 [info] <0.215.0> Node database directory at c:/Users/admin/AppData/Roaming/RabbitMQ/db/RABBIT~1 is empty. Assuming we need to join an existing cluster or initialise from scratch...
2019-04-11 13:28:41.433 [info] <0.215.0> Configured peer discovery backend: rabbit_peer_discovery_classic_config
2019-04-11 13:28:41.433 [info] <0.215.0> Will try to lock with peer discovery backend rabbit_peer_discovery_classic_config
2019-04-11 13:28:41.433 [info] <0.215.0> Peer discovery backend does not support locking, falling back to randomized delay
2019-04-11 13:28:41.433 [info] <0.215.0> Peer discovery backend rabbit_peer_discovery_classic_config does not support registration, skipping randomized startup delay.
2019-04-11 13:28:41.433 [info] <0.215.0> All discovered existing cluster peers: 
2019-04-11 13:28:41.433 [info] <0.215.0> Discovered no peer nodes to cluster with
2019-04-11 13:28:41.433 [info] <0.43.0> Application mnesia exited with reason: stopped
2019-04-11 13:28:42.574 [info] <0.215.0> Waiting for Mnesia tables for 30000 ms, 9 retries left
2019-04-11 13:28:42.636 [info] <0.215.0> Waiting for Mnesia tables for 30000 ms, 9 retries left
2019-04-11 13:28:42.761 [info] <0.215.0> Waiting for Mnesia tables for 30000 ms, 9 retries left
2019-04-11 13:28:42.761 [info] <0.215.0> Peer discovery backend rabbit_auth_mechanism_amqplain defined by app rabbit
 (127.0.0.1:49841 -> 127.0.0.1:5672, vhost: '/', user: 'guest')

0 个答案:

没有答案