def connection(server, user, password):
credentials = pika.PlainCredentials(user, password)
try:
connection = pika.BlockingConnection(
pika.ConnectionParameters(
host=server,
credentials=credentials,
)
)
return connection
except:
message = "Failed rabbit connection to server {}".format(server)
log.exception(message)
raise RabbitConnectionFailed(message)
评论列表
文章目录