|
@@ -1,5 +1,10 @@ |
|
|
package com.telpo.dipperposition; |
|
|
package com.telpo.dipperposition; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.api.NacosFactory; |
|
|
|
|
|
import com.alibaba.nacos.api.config.ConfigService; |
|
|
|
|
|
import com.alibaba.nacos.api.config.listener.Listener; |
|
|
|
|
|
import com.alibaba.nacos.api.PropertyKeyConst; |
|
|
|
|
|
import com.alibaba.nacos.api.exception.NacosException; |
|
|
import com.telpo.dipperposition.server.DipperPositionServer; |
|
|
import com.telpo.dipperposition.server.DipperPositionServer; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.boot.SpringApplication; |
|
|
import org.springframework.boot.SpringApplication; |
|
@@ -8,7 +13,8 @@ import org.springframework.boot.context.properties.ConfigurationPropertiesScan; |
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|
|
|
|
|
|
|
|
import java.net.InetSocketAddress; |
|
|
|
|
|
|
|
|
import java.util.Properties; |
|
|
|
|
|
import java.util.concurrent.Executor; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @program: gateway |
|
|
* @program: gateway |
|
@@ -27,10 +33,26 @@ public class DipperPositionApplication { |
|
|
log.info("北斗定位服务开始!"); |
|
|
log.info("北斗定位服务开始!"); |
|
|
SpringApplication.run(DipperPositionApplication.class, args); |
|
|
SpringApplication.run(DipperPositionApplication.class, args); |
|
|
log.info("北斗定位服务启动!"); |
|
|
log.info("北斗定位服务启动!"); |
|
|
|
|
|
try { |
|
|
|
|
|
test(); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error(e.getMessage()); |
|
|
|
|
|
} |
|
|
//启动服务端 |
|
|
//启动服务端 |
|
|
DipperPositionServer nettyServer = new DipperPositionServer(); |
|
|
DipperPositionServer nettyServer = new DipperPositionServer(); |
|
|
nettyServer.startTimeAsnc(); |
|
|
nettyServer.startTimeAsnc(); |
|
|
nettyServer.startPosAsnc(); |
|
|
nettyServer.startPosAsnc(); |
|
|
nettyServer.startStarsAsnc(); |
|
|
nettyServer.startStarsAsnc(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void test() throws NacosException { |
|
|
|
|
|
String serverAddr = "172.16.192.26"; |
|
|
|
|
|
String dataId = "dipperposition-service"; |
|
|
|
|
|
String group = "DEFAULT_GROUP"; |
|
|
|
|
|
Properties properties = new Properties(); |
|
|
|
|
|
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr); |
|
|
|
|
|
ConfigService configService = NacosFactory.createConfigService(properties); |
|
|
|
|
|
String content = configService.getConfig(dataId, group, 5000); |
|
|
|
|
|
System.out.println(content); |
|
|
|
|
|
} |
|
|
} |
|
|
} |