package com.yfd.platform.component.voiceserver;

import com.yfd.platform.component.nettyserver.NettyServer;
import com.yfd.platform.config.HttpServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Order(value=21)
public class VoiceServerRunner implements CommandLineRunner {
    private static final Logger logger = LoggerFactory.getLogger(VoiceServerRunner.class);
    @Override
    public void run(String... args) throws Exception {
        new Thread(()->{
            try {
                //项目启动时已经加载好了
                new VoiceServer(8972).run();
                logger.info("Netty TCP server is started!");
            } catch (Exception e){
                logger.error("发生错误", e);
                throw new RuntimeException("Netty TCP server start failed!", e);
            }
        }).start();
    }


}

