|
|
|
@ -13,7 +13,7 @@ def shop_random(): |
|
|
|
|
return shop |
|
|
|
|
|
|
|
|
|
def send_queue(data={}): |
|
|
|
|
credentials = pika.PlainCredentials('newrain', '123456') |
|
|
|
|
credentials = pika.PlainCredentials(settings.MQUser, settings.MQPassword) |
|
|
|
|
connection = pika.BlockingConnection(pika.ConnectionParameters(settings.MQHost, settings.MQPort, credentials=credentials)) |
|
|
|
|
channel = connection.channel() |
|
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ def send_queue(data={}): |
|
|
|
|
|
|
|
|
|
def read_queue(): |
|
|
|
|
# 建立与RabbitMQ服务器的连接 |
|
|
|
|
credentials = pika.PlainCredentials('newrain', '123456') |
|
|
|
|
credentials = pika.PlainCredentials(settings.MQUser, settings.MQPassword) |
|
|
|
|
connection = pika.BlockingConnection( |
|
|
|
|
pika.ConnectionParameters(host=settings.MQHost, port=settings.MQPort, credentials=credentials) |
|
|
|
|
) |
|
|
|
@ -59,7 +59,7 @@ def index(): |
|
|
|
|
|
|
|
|
|
@app.route('/read', methods=["GET","POST"]) |
|
|
|
|
def read(): |
|
|
|
|
credentials = pika.PlainCredentials('newrain', '123456') |
|
|
|
|
credentials = pika.PlainCredentials(settings.MQUser, settings.MQPassword) |
|
|
|
|
connection = pika.BlockingConnection( |
|
|
|
|
pika.ConnectionParameters(host=settings.MQHost, port=settings.MQPort, credentials=credentials) |
|
|
|
|
) |
|
|
|
|