use of com.code.server.gate.bootstarp.WebSocketServer in project summer by foxsugar.
the class GateApplication method main.
public static void main(String[] args) throws RegisterFailedException {
SpringApplication.run(GateApplication.class, args);
SpringUtil.getBean(ServerConfig.class);
ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
ThreadPool.getInstance().executor.execute(new SocketServer());
if (serverConfig.getStartWebSocket() == 1) {
ThreadPool.getInstance().executor.execute(new WebSocketServer());
}
ServerState.isWork = true;
// 配置文件
// 注册服务
RedisManager.getGateRedisService().register(serverConfig.getServerType(), serverConfig.getServerId(), serverConfig.getHost(), serverConfig.getDomain(), serverConfig.getNetPort());
// 心跳
// 定时器
ThreadPool.execute(() -> GameTimer.getInstance().fire());
GameTimer.addTimerNode(IConstant.SECOND_5, true, () -> RedisManager.getGateRedisService().heart(serverConfig.getServerId()));
// //kafka消费者
// MsgConsumer.startAConsumer(IKafaTopic.GATE_TOPIC,serverConfig.getServerId(), new GateConsumer());
}
Aggregations