diff options
author | Guangrong Fu <fu.guangrong@zte.com.cn> | 2017-03-09 11:31:38 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@open-o.org> | 2017-03-09 11:31:38 +0000 |
commit | fe6e0e07f0cb2c78bfbd5dcf4ac7497273341bb2 (patch) | |
tree | ad6b6f63c38132e5b5a8ea7f955e010bfd37af10 /holmes-actions/src/main | |
parent | b67a0ef5ee0ef5a6d84529b6c52d5072807cc36e (diff) | |
parent | 31c419d91ab4f6b5644e1cb9c7a477038fbd3dea (diff) |
Merge "Modify port"
Diffstat (limited to 'holmes-actions/src/main')
3 files changed, 17 insertions, 13 deletions
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java index ba55562..9c6ab3c 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java @@ -15,22 +15,24 @@ */
package org.openo.holmes.common.config;
+import org.openo.holmes.common.constant.AlarmConst;
+
public class MicroServiceConfig {
- private static String getProperty(String name) {
- String value = System.getenv(name);
- if (value == null) {
- value = System.getProperty(name);
+ private static String getProperty(String name) {
+ String value = System.getenv(name);
+ if (value == null) {
+ value = System.getProperty(name);
+ }
+ return value;
}
- return value;
- }
- public static String getMsbServerAddr() {
- return getProperty("MSB_ADDR");
- }
+ public static String getMsbServerAddr() {
+ return getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT;
+ }
- public static String getServiceIp() {
- return getProperty("SERVICE_IP");
- }
+ public static String getServiceIp() {
+ return getProperty("SERVICE_IP");
+ }
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java index 3894bf3..40e15eb 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java @@ -34,4 +34,6 @@ public interface AlarmConst { String ADMIN = "admin";
int MICRO_SERVICE_STATUS_SUCCESS = 201;
+
+ int MICRO_SERVICE_PORT = 8086;
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java index 826fbd0..5e806e4 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java @@ -41,7 +41,7 @@ public class MSBRegisterUtil { ObjectMapper mapper = new ObjectMapper();
String content = mapper.writeValueAsString(entity);
HttpPost httpPost = new HttpPost("http://" + MicroServiceConfig.getMsbServerAddr()
- + ":8086/api/microservices/v1/services?createOrUpdate=false");
+ + "/api/microservices/v1/services?createOrUpdate=false");
if (StringUtils.isNotEmpty(content)) {
httpPost.setEntity(new ByteArrayEntity(content.getBytes()));
}
|