summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java')
-rw-r--r--rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java
index c7eaf15..96a1f00 100644
--- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java
+++ b/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java
@@ -16,8 +16,15 @@
package org.openo.holmes.rulemgt;
+import io.dropwizard.setup.Environment;
+import java.io.IOException;
+import lombok.extern.slf4j.Slf4j;
import org.openo.dropwizard.ioc.bundle.IOCApplication;
+import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
+import org.openo.holmes.common.config.MicroServiceConfig;
+import org.openo.holmes.common.utils.MSBRegisterUtil;
+@Slf4j
public class RuleActiveApp extends IOCApplication < RuleAppConfig > {
public static void main( String[] args ) throws Exception {
@@ -29,4 +36,26 @@ public class RuleActiveApp extends IOCApplication < RuleAppConfig > {
return "Holmes Rule Management ActiveApp APP ";
}
+ @Override
+ public void run(RuleAppConfig configuration, Environment environment) throws Exception {
+ super.run(configuration, environment);
+
+ try {
+ new MSBRegisterUtil().register(initServiceEntity());
+ } catch (IOException e) {
+ log.warn("Micro service registry httpclient close failure",e);
+ }
+
+ }
+
+ private ServiceRegisterEntity initServiceEntity() {
+ ServiceRegisterEntity serviceRegisterEntity = new ServiceRegisterEntity();
+ serviceRegisterEntity.setServiceName("holmes-rule-mgmt");
+ serviceRegisterEntity.setProtocol("REST");
+ serviceRegisterEntity.setVersion("v1");
+ serviceRegisterEntity.setUrl("/openoapi/holmes-rule-mgmt/v1");
+ serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9101", 0);
+ serviceRegisterEntity.setVisualRange("1|0");
+ return serviceRegisterEntity;
+ }
}