diff options
Diffstat (limited to 'holmes-actions')
3 files changed, 8 insertions, 7 deletions
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java b/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java index eb9deef..c8e03e9 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java @@ -26,10 +26,11 @@ import org.openo.holmes.common.api.entity.ServiceRegisterEntity; @Path("/openoapi/microservices/v1/services")
public interface MicroserviceBusRest {
+
@Path("")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
- ServiceRegisterEntity entity) throws Exception;
+ ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
+ ServiceRegisterEntity entity);
}
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 91e28a6..f7825e7 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 @@ -35,7 +35,7 @@ public class MSBRegisterUtil { while (!flag && retry < 20) {
log.info("Holmes microservice register. retry:" + retry);
retry++;
- flag = inner_register(entity);
+ flag = innerRegister(entity);
if (!flag) {
log.warn("micro service register failed, sleep 30S and try again.");
threadSleep(30000);
@@ -47,7 +47,7 @@ public class MSBRegisterUtil { log.info("holmes micro service register end.");
}
- private boolean inner_register(ServiceRegisterEntity entity) {
+ private boolean innerRegister(ServiceRegisterEntity entity) {
try {
log.info("msbServerAddr:" + MicroServiceConfig.getMsbServerAddr());
log.info("entity:" + entity);
@@ -55,7 +55,7 @@ public class MSBRegisterUtil { MicroServiceConfig.getMsbServerAddr(), MicroserviceBusRest.class);
resourceserviceproxy.registerServce("false", entity);
} catch (Exception error) {
- log.error("microservice register failed!" + error.getMessage());
+ log.error("microservice register failed!" + error.getMessage(), error);
return false;
}
return true;
@@ -66,7 +66,7 @@ public class MSBRegisterUtil { try {
Thread.sleep(second);
} catch (InterruptedException error) {
- log.error("thread sleep error.errorMsg:" + error.getMessage());
+ log.error("thread sleep error.errorMsg:" + error.getMessage(), error);
}
log.info("sleep end .");
}
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java b/holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java index 0845981..5d04c1a 100644 --- a/holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java +++ b/holmes-actions/src/test/java/org/openo/holmes/common/utils/MSBRegisterUtilTest.java @@ -65,7 +65,7 @@ public class MSBRegisterUtilTest { @Override
public ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
- ServiceRegisterEntity entity) throws Exception {
+ ServiceRegisterEntity entity) {
return null;
}
}
|