diff options
author | HuabingZhao <zhao.huabing@zte.com.cn> | 2018-03-21 09:14:25 +0800 |
---|---|---|
committer | HuabingZhao <zhao.huabing@zte.com.cn> | 2018-03-21 09:14:30 +0800 |
commit | fd00a6849e072eb429e7ed7181588389f39bbdff (patch) | |
tree | 9cda0de5fb403ed3205ec78bcd77aa036bfac55f /example | |
parent | 722d78240f9ae320ceb262b496cf8cee07ae2591 (diff) |
Support healthy check for registered services
Issue-ID: MSB-180
Change-Id: I352dfe32d3fbc1c7736ffbbb7b72718e6bbb5e01
Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
Diffstat (limited to 'example')
5 files changed, 35 insertions, 34 deletions
diff --git a/example/pom.xml b/example/pom.xml index 81dc972..19c3ebf 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -2,11 +2,13 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <!-- <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> + --> <groupId>org.onap.msb.java-sdk</groupId> <artifactId>msb-java-sdk-example</artifactId> diff --git a/example/src/main/java/org/onap/msb/sdk/example/client/AnimalServiceClient.java b/example/src/main/java/org/onap/msb/sdk/example/client/AnimalServiceClient.java index cd9ebbb..aa6b9e3 100644 --- a/example/src/main/java/org/onap/msb/sdk/example/client/AnimalServiceClient.java +++ b/example/src/main/java/org/onap/msb/sdk/example/client/AnimalServiceClient.java @@ -23,6 +23,6 @@ import retrofit2.http.Path; @ServiceHttpEndPoint(serviceName = "animals", serviceVersion = "v1") public interface AnimalServiceClient { - @GET("animals/{name}") - Call<Animal> queryAnimal(@Path("name") String name); + @GET("animals/{name}") + Call<Animal> queryAnimal(@Path("name") String name); } diff --git a/example/src/main/java/org/onap/msb/sdk/example/client/ExampleClient.java b/example/src/main/java/org/onap/msb/sdk/example/client/ExampleClient.java index 4184b02..968621f 100644 --- a/example/src/main/java/org/onap/msb/sdk/example/client/ExampleClient.java +++ b/example/src/main/java/org/onap/msb/sdk/example/client/ExampleClient.java @@ -29,8 +29,8 @@ public class ExampleClient { public static void main(String[] args) throws IOException { // For real use case, MSB discovery IP and Port should come from configuration file instead // of hard code here - String msb_discovery_ip = "127.0.0.1"; - int msb_discovery_port = 10081; + String msb_discovery_ip = "10.96.33.44"; + int msb_discovery_port = 30080; MSBServiceClient msbClient = new MSBServiceClient(msb_discovery_ip, msb_discovery_port); diff --git a/example/src/main/java/org/onap/msb/sdk/example/server/ExampleApp.java b/example/src/main/java/org/onap/msb/sdk/example/server/ExampleApp.java index 7e74ed2..002a358 100644 --- a/example/src/main/java/org/onap/msb/sdk/example/server/ExampleApp.java +++ b/example/src/main/java/org/onap/msb/sdk/example/server/ExampleApp.java @@ -40,8 +40,8 @@ public class ExampleApp extends Application<Config> { public void run(Config configuration, Environment environment) throws Exception { // For real use case, MSB discovery IP and Port should come from configuration file instead // of hard code here - String msb_discovery_ip = "127.0.0.1"; - int msb_discovery_port = 10081; + String msb_discovery_ip = "10.96.33.44"; + int msb_discovery_port = 30081; environment.jersey().register(new AnimalResource()); diff --git a/example/src/main/java/org/onap/msb/sdk/example/server/MsbHelper.java b/example/src/main/java/org/onap/msb/sdk/example/server/MsbHelper.java index bd49a9b..c3cab67 100644 --- a/example/src/main/java/org/onap/msb/sdk/example/server/MsbHelper.java +++ b/example/src/main/java/org/onap/msb/sdk/example/server/MsbHelper.java @@ -24,32 +24,31 @@ import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; public class MsbHelper { - private MSBServiceClient msbClient; - - public MsbHelper(MSBServiceClient msbClient) { - super(); - this.msbClient = msbClient; - } - - - - public void registerMsb() throws Exception { - - - MicroServiceInfo msinfo = new MicroServiceInfo(); - - msinfo.setServiceName("animals"); - msinfo.setVersion("v1"); - msinfo.setUrl("/api/rpc/v1"); - msinfo.setProtocol("REST"); - msinfo.setVisualRange("0|1"); - - Set<Node> nodes = new HashSet<>(); - Node node1 = new Node(); - node1.setIp(InetAddress.getLocalHost().getHostAddress()); - node1.setPort("9090"); - nodes.add(node1); - msinfo.setNodes(nodes); - msbClient.registerMicroServiceInfo(msinfo, false); - } + private MSBServiceClient msbClient; + + public MsbHelper(MSBServiceClient msbClient) { + super(); + this.msbClient = msbClient; + } + + + + public void registerMsb() throws Exception { + MicroServiceInfo msinfo = new MicroServiceInfo(); + msinfo.setServiceName("animals"); + msinfo.setVersion("v1"); + msinfo.setUrl("/api/rpc/v1"); + msinfo.setProtocol("REST"); + msinfo.setVisualRange("0|1"); + + Set<Node> nodes = new HashSet<>(); + Node node1 = new Node(); + node1.setIp(InetAddress.getLocalHost().getHostAddress()); + node1.setPort("9090"); + node1.setCheckType("HTTP"); + node1.setCheckUrl("http://10.74.57.151:9090/api/rpc/v1/animals/panda"); + nodes.add(node1); + msinfo.setNodes(nodes); + msbClient.registerMicroServiceInfo(msinfo, false); + } } |