def getMqConf(mqConfig,serverName,vServerErrors):
pollName = "CheckRabbitMq"
errors = set()
# mqAmqpConnection if first working mq was found and res is corresponding mqConf
res=None
for mqConf in mqConfig:
try:
con = pika.BlockingConnection(pika.URLParameters(mqConf['amqpUrl']))
except Exception as e:
errors.add(str(e))
else:
if res is None:
# use first working connection in later tasks
res=mqConf
#close amqplink
if con.is_open:
con.close()
# endfor
vServerErrors.update(formatErrors(errors, serverName, pollName))
return res
评论列表
文章目录