package com.docus.server.collect.web.utils;

import com.docus.server.common.bean.MqQueue;
import com.docus.server.common.declare.AmQueueDeclare;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MqQueueUtils {
    @Autowired
    AmQueueDeclare amQueueDeclare;

    public void DeclareQueue(String mqKey) {
        MqQueue mqQueue = new MqQueue();
        mqQueue.setName(mqKey);
        mqQueue.setExclusive(false);
        mqQueue.setAutoDelete(false);
        mqQueue.setDurable(false);
        if (!this.amQueueDeclare.isQueueExist(mqKey)) {
            this.amQueueDeclare.declareQueue(mqQueue);
        }
    }
}
