From c7f3ca5ab40aef50be5df2d776906eec46afbaa7 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 31 Jul 2023 10:40:54 +0800 Subject: [PATCH] fix --- constants/rabbitmq.go | 6 ------ initalize/rabbitmq.go | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/constants/rabbitmq.go b/constants/rabbitmq.go index c7b8281e..85269033 100644 --- a/constants/rabbitmq.go +++ b/constants/rabbitmq.go @@ -9,9 +9,3 @@ const ( //渲染结果数据队列 RABBIT_MQ_RENDER_RESULT_DATA RABBIT_MQ = "RABBIT_MQ_RENDER_RESULT_DATA" ) - -// 队列列表 -var MQ_QUEUE_ARR = []RABBIT_MQ{ - RABBIT_MQ_ASSEMBLE_RENDER_DATA, - RABBIT_MQ_RENDER_RESULT_DATA, -} diff --git a/initalize/rabbitmq.go b/initalize/rabbitmq.go index 3713a7b8..fc92d496 100644 --- a/initalize/rabbitmq.go +++ b/initalize/rabbitmq.go @@ -18,6 +18,12 @@ type queueItem struct { queue amqp.Queue } +// 队列列表 +var mqQueueArr = []constants.RABBIT_MQ{ + constants.RABBIT_MQ_ASSEMBLE_RENDER_DATA, + constants.RABBIT_MQ_RENDER_RESULT_DATA, +} + // 存储连接 var mapMq = make(map[constants.RABBIT_MQ]queueItem) @@ -35,7 +41,7 @@ func InitRabbitMq(url string, config *tls.Config) *RabbitMqHandle { log.Fatalf("Failed to open a channel: %v", err) } //声明队列 - for _, queueName := range constants.MQ_QUEUE_ARR { + for _, queueName := range mqQueueArr { q, err := ch.QueueDeclare( string(queueName), // 队列名 true, // 是否持久化