多服单进程启动
提示
在部署方面,ioGame 支持多服单进程的方式部署,也支持多服多进程多机器的方式部署,在部署方式上可以随意的切换而不需要更改代码。 日常中我们可以按照单体思维开发,到了生产可以选择性的使用多进程的方式部署。
介绍
我们可以在一个进程中,同时启动游戏对外服、游戏网关、游戏逻辑服。
代码说明
- code 14,设置游戏对外服
- code 15,设置游戏网关
- code 16,设置游戏逻辑服列表
- code 17,启动
public class MyOneApplication {
public static void main(String[] args) {
ExternalServer externalServer = new MyExternalServer()
.createExternalServer(ExternalGlobalConfig.externalPort);
BrokerServer brokerServer = new MyBrokerServer()
.createBrokerServer();
WeatherLogicStartup weatherLogicStartup = new WeatherLogicStartup();
List<AbstractBrokerClientStartup> logicServerList = List.of(weatherLogicStartup);
new NettyRunOne()
.setExternalServer(externalServer)
.setBrokerServer(brokerServer)
.setLogicServerList(logicServerList)
.startup();
}
}
Example Source Code
see https://github.com/iohao/ioGameExamples
path : SimpleExample/example-multiple
- MyOneApplication