package com.mortals.xhx.daemon.applicationservice;

import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.base.framework.listener.CustomerKeyExpirationListener;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

import com.mortals.framework.springcloud.service.IApplicationService;

import java.time.Duration;

@Component
@Slf4j
public class DeviceStartService implements IApplicationService {

    @Autowired
    private SendTaskThreadPool sendTaskThreadPool;
    @Autowired
    private ICacheService cacheService;

    @Override
    public void start() {
        log.info("初始化发送线程数量");
        sendTaskThreadPool.init(20);
        log.info("初始化过期key监听事件");
        for(int i=0;i<100;i++){
            cacheService.setnx("test-expire"+i,"111", 10+i);
        }

        log.info("开始服务..[配置已加载完成，但部分框架还未初始化，比如：Kafka]");
    }

    @Override
    public void stop() {
        log.info("停止服务..");
    }

}
