+/*\r
+ * Copyright 2017 ZTE Corporation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.holmes.dsa.dmaap;\r
+\r
+import io.dropwizard.setup.Environment;\r
+import java.io.IOException;\r
+import lombok.extern.slf4j.Slf4j;\r
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;\r
+import org.onap.holmes.common.config.MicroServiceConfig;\r
+import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;\r
+import org.onap.holmes.common.utils.MSBRegisterUtil;\r
+\r
+@Slf4j\r
+public class DmaapDsaActiveApp extends IOCApplication<DmaapDsaConfig> {\r
+ public static void main(String[] args) throws Exception {\r
+ new DmaapDsaActiveApp().run(args);\r
+ }\r
+\r
+ @Override\r
+ public void run(DmaapDsaConfig configuration, Environment environment) throws Exception {\r
+ super.run(configuration, environment);\r
+\r
+ try {\r
+ new MSBRegisterUtil().register(initServiceEntity());\r
+ } catch (IOException e) {\r
+ log.warn("Micro service registry httpclient close failure", e);\r
+ }\r
+ }\r
+\r
+ private ServiceRegisterEntity initServiceEntity() {\r
+ ServiceRegisterEntity serviceRegisterEntity = new ServiceRegisterEntity();\r
+ serviceRegisterEntity.setServiceName("holmes-dmaap-dsa");\r
+ serviceRegisterEntity.setProtocol("REST");\r
+ serviceRegisterEntity.setVersion("v1");\r
+ serviceRegisterEntity.setUrl("/onapapi/holmes-dmaap-dsa/v1/");\r
+ serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9103", 0);\r
+ serviceRegisterEntity.setVisualRange("1|0");\r
+ return serviceRegisterEntity;\r
+ }\r
+}\r