This commit is contained in:
laodaming 2023-07-31 10:40:54 +08:00
parent 5a713d4d9d
commit c7f3ca5ab4
2 changed files with 7 additions and 7 deletions

View File

@ -9,9 +9,3 @@ const (
//渲染结果数据队列 //渲染结果数据队列
RABBIT_MQ_RENDER_RESULT_DATA RABBIT_MQ = "RABBIT_MQ_RENDER_RESULT_DATA" 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,
}

View File

@ -18,6 +18,12 @@ type queueItem struct {
queue amqp.Queue 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) 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) log.Fatalf("Failed to open a channel: %v", err)
} }
//声明队列 //声明队列
for _, queueName := range constants.MQ_QUEUE_ARR { for _, queueName := range mqQueueArr {
q, err := ch.QueueDeclare( q, err := ch.QueueDeclare(
string(queueName), // 队列名 string(queueName), // 队列名
true, // 是否持久化 true, // 是否持久化