pika import sys connection = pika.BlockingConnection(pika.ConnectionParameters( host=)) channel = connection.channel() channel.exchange_declare(exchange=, type=) routing_key = sys.argv[1] message = channel.basic_publish(exchange=, routing_key=routing_key, body=message) % (routing_key, message)) connection.close()
生产者