package org.ts.ddcs.rabbitmq;

import org.ts.ddcs.log.LogHelper;


import org.ts.ddcs.worker.DataProcessHolder;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

//@Component
public class CheckRtuStateListener {

    @PostConstruct
    public void init() {
        LogHelper.info("************************ rabbit mq listener");
    }

    //  @RabbitListener(queuesToDeclare = @Queue("${rabbit.config.queue.checkStateQueue}"))
    public void process(String body) {
        try {
            if (null != body) {
                DataProcessHolder.newInstance().dataProcess.submitWarningProcessTask(body);
            }
        } catch (Exception e) {
            LogHelper.error(e);
        }
    }

    //  @RabbitListener(queuesToDeclare = @Queue("${rabbit.config.queue.warningMessage}"))
    public void warningProcess(String body) {
        try {
            if (null != body) {
                DataProcessHolder.newInstance().dataProcess.submitWarningProcessTask(body);
            }
        } catch (Exception e) {
            LogHelper.error(e);
        }
    }
}
