|
|
@@ -24,48 +24,14 @@ public class DipperPositionController { |
|
|
|
|
|
|
|
@RequestMapping("/getPos") |
|
|
|
public String getPos() throws NacosException, InterruptedException { |
|
|
|
String serverAddr = "localhost"; |
|
|
|
String dataId = "dipperposition-service-dev"; |
|
|
|
String group = "DEFAULT_GROUP"; |
|
|
|
|
|
|
|
String positionId = "String.hello"; |
|
|
|
String positionId = "position.hello"; |
|
|
|
Properties properties = new Properties(); |
|
|
|
String serverAddr = "172.16.192.26"; |
|
|
|
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr); |
|
|
|
ConfigService configService = NacosFactory.createConfigService(properties); |
|
|
|
String content = configService.getConfig(dataId, group, 10000); |
|
|
|
String content = configService.getConfig(positionId, group, 10000); |
|
|
|
System.out.println(content); |
|
|
|
configService.addListener(dataId, group, new Listener() { |
|
|
|
@Override |
|
|
|
public void receiveConfigInfo(String configInfo) { |
|
|
|
log.info("recieve:" + configInfo); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Executor getExecutor() { |
|
|
|
return null; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
boolean isPublishOk = configService.publishConfig(dataId, group, "content"); |
|
|
|
log.info(String.valueOf(isPublishOk)); |
|
|
|
Thread.sleep(3000); |
|
|
|
|
|
|
|
configService = NacosFactory.createConfigService(properties); |
|
|
|
content = configService.getConfig(dataId, group, 10000); |
|
|
|
log.info(content); |
|
|
|
|
|
|
|
content = configService.getConfig(positionId, group, 10000); |
|
|
|
log.info(content); |
|
|
|
|
|
|
|
//boolean isRemoveOk = configService.removeConfig(dataId, group); |
|
|
|
//log.info(String.valueOf(isRemoveOk)); |
|
|
|
//Thread.sleep(3000); |
|
|
|
|
|
|
|
//content = configService.getConfig(dataId, group, 10000); |
|
|
|
//log.info(content); |
|
|
|
//Thread.sleep(30000); |
|
|
|
|
|
|
|
//System.out.println(content); |
|
|
|
|
|
|
|
return "Helle world!"; //ContextLoader.getCurrentWebApplicationContext().toString(); |
|
|
|
} |
|
|
|