package cc.smtweb.system.canal.file;

import cc.smtweb.framework.core.annotation.SwStartListener;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.mvc.controller.IStartListener;
import cc.smtweb.framework.core.systask.SysServiceFactory;
import cc.smtweb.framework.core.util.SpringUtil;
import cc.smtweb.system.canal.file.common.FileDecodeConfig;
import cc.smtweb.system.canal.file.common.FileDecodeService;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author yaoq
 * @Date 2022年09月06日 10:31
 * @Description
 */
@Slf4j
@SwStartListener
public class CanalFileStartedListener implements IStartListener {

    @Override
    public int order() {
        return SwConsts.DEFAULT_ORDER + 3;
    }


    @Override
    public void init() {
        FileDecodeConfig config = SpringUtil.getBean(FileDecodeConfig.class);
        SwConsts.SysParam.enableCanal = true;
        SwConsts.SysParam.RUN_PROJECTS = "";
        if(config.isEnable()) SysServiceFactory.getInstance().reg(new FileDecodeService());
    }

    @Override
    public void run() {

    }
}
