package cc.smtweb.system.canal.example;

import cc.smtweb.framework.core.annotation.SwStartListener;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.mvc.controller.IStartListener;
import lombok.extern.slf4j.Slf4j;

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

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


    @Override
    public void init() {

    }

    @Override
    public void run() {
        if (!SwConsts.SysParam.enableCanal) return;
        ClientInstance.getInstance().start();
    }

    @Override
    public void close() {
        if (!SwConsts.SysParam.enableCanal) return;
        ClientInstance.getInstance().stop();
    }
}
