*/\r
package org.openo.holmes.common.config;\r
\r
+import org.openo.holmes.common.constant.AlarmConst;\r
+\r
public class MicroServiceConfig {\r
\r
- private static String getProperty(String name) {\r
- String value = System.getenv(name);\r
- if (value == null) {\r
- value = System.getProperty(name);\r
+ private static String getProperty(String name) {\r
+ String value = System.getenv(name);\r
+ if (value == null) {\r
+ value = System.getProperty(name);\r
+ }\r
+ return value;\r
}\r
- return value;\r
- }\r
\r
- public static String getMsbServerAddr() {\r
- return getProperty("MSB_ADDR");\r
- }\r
+ public static String getMsbServerAddr() {\r
+ return getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT;\r
+ }\r
\r
- public static String getServiceIp() {\r
- return getProperty("SERVICE_IP");\r
- }\r
+ public static String getServiceIp() {\r
+ return getProperty("SERVICE_IP");\r
+ }\r
\r
}\r
ObjectMapper mapper = new ObjectMapper();\r
String content = mapper.writeValueAsString(entity);\r
HttpPost httpPost = new HttpPost("http://" + MicroServiceConfig.getMsbServerAddr()\r
- + ":8086/api/microservices/v1/services?createOrUpdate=false");\r
+ + "/api/microservices/v1/services?createOrUpdate=false");\r
if (StringUtils.isNotEmpty(content)) {\r
httpPost.setEntity(new ByteArrayEntity(content.getBytes()));\r
}\r