This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b07b6e2a [SCB-2863]support zookeeper registry (#4276)
3b07b6e2a is described below

commit 3b07b6e2afe86be03531695b6071f67bf763437e
Author: liubao68 <[email protected]>
AuthorDate: Mon Apr 1 14:15:13 2024 +0800

    [SCB-2863]support zookeeper registry (#4276)
---
 demo/demo-zookeeper/consumer/pom.xml               |  82 ++++++++
 .../servicecomb/samples/ConsumerApplication.java   |  33 ++++
 .../servicecomb/samples/ConsumerController.java    |  37 ++++
 .../servicecomb/samples/ProviderService.java       |  22 +++
 .../consumer/src/main/resources/application.yml    |  34 ++++
 .../consumer/src/main/resources/log4j2.xml         |  41 ++++
 demo/demo-zookeeper/gateway/pom.xml                |  85 +++++++++
 .../servicecomb/samples/GatewayApplication.java    |  33 ++++
 .../gateway/src/main/resources/application.yml     |  44 +++++
 .../gateway/src/main/resources/log4j2.xml          |  41 ++++
 {service-registry => demo/demo-zookeeper}/pom.xml  |  43 +++--
 demo/demo-zookeeper/provider/pom.xml               |  86 +++++++++
 .../servicecomb/samples/ProviderApplication.java   |  33 ++++
 .../servicecomb/samples/ProviderController.java    |  33 ++++
 .../provider/src/main/resources/application.yml    |  33 ++++
 .../provider/src/main/resources/log4j2.xml         |  41 ++++
 demo/demo-zookeeper/test-client/pom.xml            | 209 +++++++++++++++++++++
 .../org/apache/servicecomb/samples/Config.java     |  22 +++
 .../apache/servicecomb/samples/HelloWorldIT.java   |  40 ++++
 .../servicecomb/samples/TestClientApplication.java |  49 +++++
 .../test-client/src/main/resources/application.yml |  25 +++
 .../test-client/src/main/resources/log4j2.xml      |  41 ++++
 .../apache/servicecomb/samples/ZookeeperIT.java    |  43 +++++
 demo/pom.xml                                       |   1 +
 dependencies/bom/pom.xml                           |   5 +
 dependencies/default/pom.xml                       |  12 ++
 service-registry/pom.xml                           |   1 +
 service-registry/{ => registry-zookeeper}/pom.xml  |  43 +++--
 .../registry/zookeeper/ZookeeperConfiguration.java |  40 ++++
 .../registry/zookeeper/ZookeeperConst.java         |  29 +++
 .../registry/zookeeper/ZookeeperDiscovery.java     | 165 ++++++++++++++++
 .../zookeeper/ZookeeperDiscoveryInstance.java      |  36 ++++
 .../registry/zookeeper/ZookeeperInstance.java      | 190 +++++++++++++++++++
 .../registry/zookeeper/ZookeeperRegistration.java  | 169 +++++++++++++++++
 .../zookeeper/ZookeeperRegistrationInstance.java   |  36 ++++
 .../zookeeper/ZookeeperRegistryProperties.java     |  79 ++++++++
 ...rk.boot.autoconfigure.AutoConfiguration.imports |  18 ++
 37 files changed, 1947 insertions(+), 27 deletions(-)

diff --git a/demo/demo-zookeeper/consumer/pom.xml 
b/demo/demo-zookeeper/consumer/pom.xml
new file mode 100644
index 000000000..23a62be5f
--- /dev/null
+++ b/demo/demo-zookeeper/consumer/pom.xml
@@ -0,0 +1,82 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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.apache.servicecomb.demo</groupId>
+    <artifactId>demo-zookeeper</artifactId>
+    <version>3.1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>zookeeper-consumer</artifactId>
+  <name>Java Chassis::Demo::Zookeeper::CONSUMER</name>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>registry-zookeeper</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.commonjava.maven.plugins</groupId>
+            <artifactId>directory-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>com.github.odavid.maven.plugins</groupId>
+            <artifactId>mixin-maven-plugin</artifactId>
+            <configuration>
+              <mixins>
+                <mixin>
+                  <groupId>org.apache.servicecomb.demo</groupId>
+                  <artifactId>docker-build-config</artifactId>
+                  <version>${project.version}</version>
+                </mixin>
+              </mixins>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file
diff --git 
a/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
 
b/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
new file mode 100644
index 000000000..3e7a2a0e2
--- /dev/null
+++ 
b/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+@SpringBootApplication
+public class ConsumerApplication {
+  public static void main(String[] args) throws Exception {
+    try {
+      new 
SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsumerApplication.class).run(args);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+}
diff --git 
a/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
 
b/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
new file mode 100644
index 000000000..4ed0ecd85
--- /dev/null
+++ 
b/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "ConsumerController")
+@RequestMapping(path = "/")
+public class ConsumerController {
+  @RpcReference(schemaId = "ProviderController", microserviceName = "provider")
+  private ProviderService providerService;
+
+  // consumer service which delegate the implementation to provider service.
+  @GetMapping("/sayHello")
+  public String sayHello(@RequestParam("name") String name) {
+    return providerService.sayHello(name);
+  }
+}
diff --git 
a/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
 
b/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
new file mode 100644
index 000000000..f327412b7
--- /dev/null
+++ 
b/demo/demo-zookeeper/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+public interface ProviderService {
+  String sayHello(String name);
+}
diff --git a/demo/demo-zookeeper/consumer/src/main/resources/application.yml 
b/demo/demo-zookeeper/consumer/src/main/resources/application.yml
new file mode 100644
index 000000000..7c779881b
--- /dev/null
+++ b/demo/demo-zookeeper/consumer/src/main/resources/application.yml
@@ -0,0 +1,34 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+  service:
+    application: demo-zookeeper
+    version: 0.0.1
+    name: consumer
+    properties:
+      group: red
+  registry:
+    zk:
+      enabled: true
+      connectString: 127.0.0.1:2181
+
+  rest:
+    address: 0.0.0.0:9092
+
+
+
diff --git a/demo/demo-zookeeper/consumer/src/main/resources/log4j2.xml 
b/demo/demo-zookeeper/consumer/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..6e6586771
--- /dev/null
+++ b/demo/demo-zookeeper/consumer/src/main/resources/log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+<configuration>
+  <Appenders>
+    <!-- can use MarkerFilter to separate logs with trace id
+    <Console name="Console" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMatch="DENY" 
onMismatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <Console name="Console-Tracing" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMismatch="DENY" 
onMatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+    -->
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/demo/demo-zookeeper/gateway/pom.xml 
b/demo/demo-zookeeper/gateway/pom.xml
new file mode 100644
index 000000000..c55007d81
--- /dev/null
+++ b/demo/demo-zookeeper/gateway/pom.xml
@@ -0,0 +1,85 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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.apache.servicecomb.demo</groupId>
+    <artifactId>demo-zookeeper</artifactId>
+    <version>3.1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>zookeeper-gateway</artifactId>
+  <name>Java Chassis::Demo::Zookeeper::GATEWAY</name>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>edge-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>registry-zookeeper</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.commonjava.maven.plugins</groupId>
+            <artifactId>directory-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>com.github.odavid.maven.plugins</groupId>
+            <artifactId>mixin-maven-plugin</artifactId>
+            <configuration>
+              <mixins>
+                <mixin>
+                  <groupId>org.apache.servicecomb.demo</groupId>
+                  <artifactId>docker-build-config</artifactId>
+                  <version>${project.version}</version>
+                </mixin>
+              </mixins>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file
diff --git 
a/demo/demo-zookeeper/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
 
b/demo/demo-zookeeper/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
new file mode 100644
index 000000000..7d58caafd
--- /dev/null
+++ 
b/demo/demo-zookeeper/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+@SpringBootApplication
+public class GatewayApplication {
+  public static void main(String[] args) throws Exception {
+    try {
+      new 
SpringApplicationBuilder().web(WebApplicationType.NONE).sources(GatewayApplication.class).run(args);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+}
diff --git a/demo/demo-zookeeper/gateway/src/main/resources/application.yml 
b/demo/demo-zookeeper/gateway/src/main/resources/application.yml
new file mode 100644
index 000000000..f63d61c27
--- /dev/null
+++ b/demo/demo-zookeeper/gateway/src/main/resources/application.yml
@@ -0,0 +1,44 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+  service:
+    application: demo-zookeeper
+    version: 0.0.1
+    name: gateway
+  registry:
+    zk:
+      enabled: true
+      connectString: 127.0.0.1:2181
+
+  rest:
+    address: 0.0.0.0:9090?sslEnabled=false
+
+  http:
+    dispatcher:
+      edge:
+        default:
+          enabled: false
+        url:
+          enabled: true
+          pattern: /(.*)
+          mappings:
+            consumer:
+              prefixSegmentCount: 0
+              path: "/.*"
+              microserviceName: consumer
+              versionRule: 0.0.0+
diff --git a/demo/demo-zookeeper/gateway/src/main/resources/log4j2.xml 
b/demo/demo-zookeeper/gateway/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..6e6586771
--- /dev/null
+++ b/demo/demo-zookeeper/gateway/src/main/resources/log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+<configuration>
+  <Appenders>
+    <!-- can use MarkerFilter to separate logs with trace id
+    <Console name="Console" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMatch="DENY" 
onMismatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <Console name="Console-Tracing" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMismatch="DENY" 
onMatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+    -->
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/service-registry/pom.xml b/demo/demo-zookeeper/pom.xml
similarity index 58%
copy from service-registry/pom.xml
copy to demo/demo-zookeeper/pom.xml
index e0fb9a7f8..49d9b8e40 100644
--- a/service-registry/pom.xml
+++ b/demo/demo-zookeeper/pom.xml
@@ -18,23 +18,40 @@
 
 <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.apache.servicecomb</groupId>
-    <artifactId>java-chassis-parent</artifactId>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-parent</artifactId>
     <version>3.1.0-SNAPSHOT</version>
-    <relativePath>../parents/default</relativePath>
   </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>service-registry-parent</artifactId>
-  <name>Java Chassis::Service Registry</name>
+  <artifactId>demo-zookeeper</artifactId>
+  <name>Java Chassis::Demo::Zookeeper</name>
   <packaging>pom</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>solution-basic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
+  </dependencies>
 
   <modules>
-    <module>registry-local</module>
-    <module>registry-service-center</module>
-    <module>registry-lightweight</module>
-    <module>registry-zero-config</module>
-    <module>registry-nacos</module>
+    <module>provider</module>
+    <module>consumer</module>
+    <module>gateway</module>
+    <module>test-client</module>
   </modules>
-</project>
+
+</project>
\ No newline at end of file
diff --git a/demo/demo-zookeeper/provider/pom.xml 
b/demo/demo-zookeeper/provider/pom.xml
new file mode 100644
index 000000000..02d0f0a53
--- /dev/null
+++ b/demo/demo-zookeeper/provider/pom.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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.apache.servicecomb.demo</groupId>
+    <artifactId>demo-zookeeper</artifactId>
+    <version>3.1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>zookeeper-provider</artifactId>
+  <name>Java Chassis::Demo::Zookeeper::PROVIDER</name>
+  <packaging>jar</packaging>
+
+  <properties>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>registry-zookeeper</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.commonjava.maven.plugins</groupId>
+            <artifactId>directory-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>com.github.odavid.maven.plugins</groupId>
+            <artifactId>mixin-maven-plugin</artifactId>
+            <configuration>
+              <mixins>
+                <mixin>
+                  <groupId>org.apache.servicecomb.demo</groupId>
+                  <artifactId>docker-build-config</artifactId>
+                  <version>${project.version}</version>
+                </mixin>
+              </mixins>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file
diff --git 
a/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
 
b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
new file mode 100644
index 000000000..fde6f36b2
--- /dev/null
+++ 
b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+@SpringBootApplication
+public class ProviderApplication {
+  public static void main(String[] args) throws Exception {
+    try {
+      new 
SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ProviderApplication.class).run(args);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+}
diff --git 
a/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
 
b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
new file mode 100644
index 000000000..6eea7776a
--- /dev/null
+++ 
b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "ProviderController")
+@RequestMapping(path = "/")
+public class ProviderController {
+  // a very simple service to echo the request parameter
+  @GetMapping("/sayHello")
+  public String sayHello(@RequestParam("name") String name) {
+    return "Hello " + name;
+  }
+}
diff --git a/demo/demo-zookeeper/provider/src/main/resources/application.yml 
b/demo/demo-zookeeper/provider/src/main/resources/application.yml
new file mode 100644
index 000000000..a679658c6
--- /dev/null
+++ b/demo/demo-zookeeper/provider/src/main/resources/application.yml
@@ -0,0 +1,33 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+# spring boot configurations
+servicecomb:
+  service:
+    application: demo-zookeeper
+    version: 0.0.1
+    name: provider
+    properties:
+      group: green
+  registry:
+    zk:
+      enabled: true
+      connectString: 127.0.0.1:2181
+
+  rest:
+    address: 0.0.0.0:9094
+
diff --git a/demo/demo-zookeeper/provider/src/main/resources/log4j2.xml 
b/demo/demo-zookeeper/provider/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..6e6586771
--- /dev/null
+++ b/demo/demo-zookeeper/provider/src/main/resources/log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+<configuration>
+  <Appenders>
+    <!-- can use MarkerFilter to separate logs with trace id
+    <Console name="Console" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMatch="DENY" 
onMismatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <Console name="Console-Tracing" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMismatch="DENY" 
onMatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+    -->
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/demo/demo-zookeeper/test-client/pom.xml 
b/demo/demo-zookeeper/test-client/pom.xml
new file mode 100644
index 000000000..1483c71d3
--- /dev/null
+++ b/demo/demo-zookeeper/test-client/pom.xml
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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.apache.servicecomb.demo</groupId>
+    <artifactId>demo-zookeeper</artifactId>
+    <version>3.1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>zookeeper-test-client</artifactId>
+  <name>Java Chassis::Demo::Zookeeper::TEST-CLIENT</name>
+  <packaging>jar</packaging>
+
+  <properties>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb.demo</groupId>
+      <artifactId>demo-schema</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>registry-local</artifactId>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <pluginManagement>
+          <plugins>
+            <plugin>
+              <groupId>io.fabric8</groupId>
+              <artifactId>docker-maven-plugin</artifactId>
+              <configuration>
+                <images>
+                  <image>
+                    <name>zookeeper:3.8.3</name>
+                    <alias>zookeeper</alias>
+                    <run>
+                      <namingStrategy>alias</namingStrategy>
+                      <wait>
+                        <log>binding to port</log>
+                        <tcp>
+                          <ports>
+                            <port>2181</port>
+                          </ports>
+                        </tcp>
+                        <time>60000</time>
+                      </wait>
+                      <ports>
+                        <port>zookeeper.port:2181</port>
+                      </ports>
+                    </run>
+                  </image>
+                  <image>
+                    <name>zookeeper-provider:${project.version}</name>
+                    <alias>zookeeper-provider</alias>
+                    <run>
+                      <namingStrategy>alias</namingStrategy>
+                      <env>
+                        <JAVA_OPTS>
+                          
-Dservicecomb.registry.zk.connectString=zookeeper:2181
+                        </JAVA_OPTS>
+                        
<JAR_PATH>/maven/maven/zookeeper-provider-${project.version}.jar</JAR_PATH>
+                      </env>
+                      <links>
+                        <link>zookeeper:zookeeper</link>
+                      </links>
+                      <wait>
+                        <log>ServiceComb is ready</log>
+                        <tcp>
+                          <ports>
+                            <port>9094</port>
+                          </ports>
+                        </tcp>
+                        <time>120000</time>
+                      </wait>
+                      <ports>
+                        <port>9094:9094</port>
+                      </ports>
+                    </run>
+                  </image>
+                  <image>
+                    <name>zookeeper-consumer:${project.version}</name>
+                    <alias>zookeeper-consumer</alias>
+                    <run>
+                      <namingStrategy>alias</namingStrategy>
+                      <env>
+                        <JAVA_OPTS>
+                          
-Dservicecomb.registry.zk.connectString=zookeeper:2181
+                        </JAVA_OPTS>
+                        
<JAR_PATH>/maven/maven/zookeeper-consumer-${project.version}.jar</JAR_PATH>
+                      </env>
+                      <links>
+                        <link>zookeeper:zookeeper</link>
+                      </links>
+                      <wait>
+                        <log>ServiceComb is ready</log>
+                        <tcp>
+                          <ports>
+                            <port>9092</port>
+                          </ports>
+                        </tcp>
+                        <time>120000</time>
+                      </wait>
+                      <ports>
+                        <port>9092:9092</port>
+                      </ports>
+                    </run>
+                  </image>
+                  <image>
+                    <name>zookeeper-gateway:${project.version}</name>
+                    <alias>zookeeper-gateway</alias>
+                    <run>
+                      <namingStrategy>alias</namingStrategy>
+                      <env>
+                        <JAVA_OPTS>
+                          
-Dservicecomb.registry.zk.connectString=zookeeper:2181
+                        </JAVA_OPTS>
+                        
<JAR_PATH>/maven/maven/zookeeper-gateway-${project.version}.jar</JAR_PATH>
+                      </env>
+                      <links>
+                        <link>zookeeper:zookeeper</link>
+                      </links>
+                      <wait>
+                        <log>ServiceComb is ready</log>
+                        <tcp>
+                          <ports>
+                            <port>9090</port>
+                          </ports>
+                        </tcp>
+                        <time>120000</time>
+                      </wait>
+                      <ports>
+                        <port>9090:9090</port>
+                      </ports>
+                    </run>
+                  </image>
+                </images>
+              </configuration>
+              <executions>
+                <execution>
+                  <id>start</id>
+                  <phase>pre-integration-test</phase>
+                  <goals>
+                    <goal>start</goal>
+                  </goals>
+                </execution>
+                <execution>
+                  <id>stop</id>
+                  <phase>post-integration-test</phase>
+                  <goals>
+                    <goal>stop</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
+          </plugins>
+        </pluginManagement>
+
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>com.github.odavid.maven.plugins</groupId>
+            <artifactId>mixin-maven-plugin</artifactId>
+            <configuration>
+              <mixins>
+                <mixin>
+                  <groupId>org.apache.servicecomb.demo</groupId>
+                  <artifactId>docker-run-config</artifactId>
+                  <version>${project.version}</version>
+                </mixin>
+              </mixins>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file
diff --git 
a/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/Config.java
 
b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/Config.java
new file mode 100644
index 000000000..2e9105cdd
--- /dev/null
+++ 
b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/Config.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+public interface Config {
+  String GATEWAY_URL = "http://localhost:9090";;
+}
diff --git 
a/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java
 
b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java
new file mode 100644
index 000000000..59d06bb1e
--- /dev/null
+++ 
b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.apache.servicecomb.demo.CategorizedTestCase;
+import org.apache.servicecomb.demo.TestMgr;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestOperations;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class HelloWorldIT implements CategorizedTestCase {
+  RestOperations template = new RestTemplate();
+
+  @Override
+  public void testRestTransport() throws Exception {
+    testHelloWorld();
+  }
+
+  private void testHelloWorld() {
+    String result = template
+        .getForObject(Config.GATEWAY_URL + "/sayHello?name=World", 
String.class);
+    TestMgr.check("Hello World", result);
+  }
+}
diff --git 
a/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java
 
b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java
new file mode 100644
index 000000000..26a2a491b
--- /dev/null
+++ 
b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.apache.servicecomb.demo.CategorizedTestCaseRunner;
+import org.apache.servicecomb.demo.TestMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+@SpringBootApplication
+public class TestClientApplication {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(TestClientApplication.class);
+
+  public static void main(String[] args) throws Exception {
+    try {
+      new 
SpringApplicationBuilder().web(WebApplicationType.NONE).sources(TestClientApplication.class).run(args);
+
+      run();
+    } catch (Exception e) {
+      TestMgr.failed("test case run failed", e);
+      LOGGER.error("-------------- test failed -------------");
+      LOGGER.error("", e);
+      LOGGER.error("-------------- test failed -------------");
+    }
+    TestMgr.summary();
+  }
+
+  public static void run() throws Exception {
+    CategorizedTestCaseRunner.runCategorizedTestCase("consumer");
+  }
+}
diff --git a/demo/demo-zookeeper/test-client/src/main/resources/application.yml 
b/demo/demo-zookeeper/test-client/src/main/resources/application.yml
new file mode 100644
index 000000000..6f8a74f5c
--- /dev/null
+++ b/demo/demo-zookeeper/test-client/src/main/resources/application.yml
@@ -0,0 +1,25 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+  service:
+    application: demo-zookeeper
+    name: test-client
+    version: 0.0.1
+
+  rest:
+    address: 0.0.0.0:9097 # should be same with server.port to use web 
container
diff --git a/demo/demo-zookeeper/test-client/src/main/resources/log4j2.xml 
b/demo/demo-zookeeper/test-client/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..6e6586771
--- /dev/null
+++ b/demo/demo-zookeeper/test-client/src/main/resources/log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+<configuration>
+  <Appenders>
+    <!-- can use MarkerFilter to separate logs with trace id
+    <Console name="Console" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMatch="DENY" 
onMismatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <Console name="Console-Tracing" target="SYSTEM_OUT">
+      <MarkerFilter marker="SERVICECOMB_MARKER" onMismatch="DENY" 
onMatch="ACCEPT"/>
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+    -->
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L][%X{SERVICECOMB_TRACE_ID}] 
%m%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git 
a/demo/demo-zookeeper/test-client/src/test/java/org/apache/servicecomb/samples/ZookeeperIT.java
 
b/demo/demo-zookeeper/test-client/src/test/java/org/apache/servicecomb/samples/ZookeeperIT.java
new file mode 100644
index 000000000..cdcd276de
--- /dev/null
+++ 
b/demo/demo-zookeeper/test-client/src/test/java/org/apache/servicecomb/samples/ZookeeperIT.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.apache.servicecomb.demo.TestMgr;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(classes = TestClientApplication.class)
+public class ZookeeperIT {
+
+  @BeforeEach
+  public void setUp() {
+    TestMgr.errors().clear();
+  }
+
+  @Test
+  public void clientGetsNoError() throws Exception {
+    TestClientApplication.run();
+
+    Assertions.assertTrue(TestMgr.errors().isEmpty());
+  }
+}
diff --git a/demo/pom.xml b/demo/pom.xml
index 1601e0601..518c40d25 100644
--- a/demo/pom.xml
+++ b/demo/pom.xml
@@ -56,6 +56,7 @@
     <module>demo-cse-v1</module>
     <module>demo-cse-v2</module>
     <module>demo-nacos</module>
+    <module>demo-zookeeper</module>
   </modules>
 
   <dependencyManagement>
diff --git a/dependencies/bom/pom.xml b/dependencies/bom/pom.xml
index 10e9d4a20..c0bcd6927 100644
--- a/dependencies/bom/pom.xml
+++ b/dependencies/bom/pom.xml
@@ -268,6 +268,11 @@
         <artifactId>registry-nacos</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>registry-zookeeper</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <!-- ServiceComb: solutions -->
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml
index de4d74015..37a91e041 100644
--- a/dependencies/default/pom.xml
+++ b/dependencies/default/pom.xml
@@ -41,6 +41,7 @@
     <commons-lang3.version>3.14.0</commons-lang3.version>
     <commons-logging.version>1.3.0</commons-logging.version>
     <commons-text.version>1.11.0</commons-text.version>
+    <curator.version>5.6.0</curator.version>
     <failureaccess.version>1.0.2</failureaccess.version>
     <findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
     <governator-annotations.version>1.17.12</governator-annotations.version>
@@ -109,6 +110,17 @@
         <scope>test</scope>
       </dependency>
 
+      <dependency>
+        <groupId>org.apache.curator</groupId>
+        <artifactId>curator-x-discovery</artifactId>
+        <version>${curator.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.curator</groupId>
+        <artifactId>curator-framework</artifactId>
+        <version>${curator.version}</version>
+      </dependency>
+
       <dependency>
         <groupId>com.google.code.findbugs</groupId>
         <artifactId>jsr305</artifactId>
diff --git a/service-registry/pom.xml b/service-registry/pom.xml
index e0fb9a7f8..2bd7c8c76 100644
--- a/service-registry/pom.xml
+++ b/service-registry/pom.xml
@@ -36,5 +36,6 @@
     <module>registry-lightweight</module>
     <module>registry-zero-config</module>
     <module>registry-nacos</module>
+    <module>registry-zookeeper</module>
   </modules>
 </project>
diff --git a/service-registry/pom.xml 
b/service-registry/registry-zookeeper/pom.xml
similarity index 53%
copy from service-registry/pom.xml
copy to service-registry/registry-zookeeper/pom.xml
index e0fb9a7f8..44bbc75ce 100644
--- a/service-registry/pom.xml
+++ b/service-registry/registry-zookeeper/pom.xml
@@ -16,25 +16,40 @@
   ~ limitations under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+<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";>
   <parent>
     <groupId>org.apache.servicecomb</groupId>
-    <artifactId>java-chassis-parent</artifactId>
+    <artifactId>service-registry-parent</artifactId>
     <version>3.1.0-SNAPSHOT</version>
-    <relativePath>../parents/default</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
-  <artifactId>service-registry-parent</artifactId>
-  <name>Java Chassis::Service Registry</name>
-  <packaging>pom</packaging>
+  <artifactId>registry-zookeeper</artifactId>
+  <name>Java Chassis::Service Registry::Zookeeper</name>
 
-  <modules>
-    <module>registry-local</module>
-    <module>registry-service-center</module>
-    <module>registry-lightweight</module>
-    <module>registry-zero-config</module>
-    <module>registry-nacos</module>
-  </modules>
-</project>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-x-discovery</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-registry</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-core</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperConfiguration.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperConfiguration.java
new file mode 100644
index 000000000..39c9fd176
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperConfiguration.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ZookeeperConfiguration {
+  @Bean
+  @ConfigurationProperties(prefix = ZookeeperConst.ZOOKEEPER_REGISTRY_PREFIX)
+  public ZookeeperRegistryProperties zookeeperRegistryProperties() {
+    return new ZookeeperRegistryProperties();
+  }
+
+  @Bean
+  public ZookeeperDiscovery zookeeperDiscovery() {
+    return new ZookeeperDiscovery();
+  }
+
+  @Bean
+  public ZookeeperRegistration zookeeperRegistration() {
+    return new ZookeeperRegistration();
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperConst.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperConst.java
new file mode 100644
index 000000000..1d6d5d141
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperConst.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+public class ZookeeperConst {
+  public static final String ZOOKEEPER_REGISTRY_NAME = "zookeeper-registry";
+
+  public static final String ZOOKEEPER_DISCOVERY_ROOT = 
"/servicecomb/registry/%s";
+
+  public static final String ZOOKEEPER_REGISTRY_PREFIX = 
"servicecomb.registry.zk";
+
+  public static final String ZOOKEEPER_DISCOVERY_ENABLED = 
ZOOKEEPER_REGISTRY_PREFIX + ".%s.%s.enabled";
+
+  public static final String ZOOKEEPER_DEFAULT_ENVIRONMENT = "production";
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscovery.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscovery.java
new file mode 100644
index 000000000..09ee930e9
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscovery.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.curator.utils.CloseableUtils;
+import org.apache.curator.x.discovery.ServiceCache;
+import org.apache.curator.x.discovery.ServiceDiscovery;
+import org.apache.curator.x.discovery.ServiceDiscoveryBuilder;
+import org.apache.curator.x.discovery.ServiceInstance;
+import org.apache.curator.x.discovery.details.JsonInstanceSerializer;
+import org.apache.curator.x.discovery.details.ServiceCacheListener;
+import org.apache.servicecomb.config.BootStrapProperties;
+import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.apache.servicecomb.registry.api.Discovery;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+
+public class ZookeeperDiscovery implements 
Discovery<ZookeeperDiscoveryInstance> {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(ZookeeperDiscovery.class);
+
+  private final Map<String, ServiceCache<ZookeeperInstance>> 
serviceDiscoveries =
+      new ConcurrentHashMapEx<>();
+
+  private Environment environment;
+
+  private ZookeeperRegistryProperties zookeeperRegistryProperties;
+
+  private String basePath;
+
+  private CuratorFramework client;
+
+  private InstanceChangedListener<ZookeeperDiscoveryInstance> 
instanceChangedListener;
+
+  @Autowired
+  @SuppressWarnings("unused")
+  public void setEnvironment(Environment environment) {
+    this.environment = environment;
+  }
+
+  @Autowired
+  @SuppressWarnings("unused")
+  public void setZookeeperRegistryProperties(ZookeeperRegistryProperties 
zookeeperRegistryProperties) {
+    this.zookeeperRegistryProperties = zookeeperRegistryProperties;
+  }
+
+  @Override
+  public String name() {
+    return ZookeeperConst.ZOOKEEPER_REGISTRY_NAME;
+  }
+
+  @Override
+  public boolean enabled(String application, String serviceName) {
+    return 
environment.getProperty(String.format(ZookeeperConst.ZOOKEEPER_DISCOVERY_ENABLED,
 application, serviceName),
+        boolean.class, true);
+  }
+
+  @Override
+  public List<ZookeeperDiscoveryInstance> findServiceInstances(String 
application, String serviceName) {
+    try {
+      ServiceCache<ZookeeperInstance> discovery = 
serviceDiscoveries.computeIfAbsent(application, app -> {
+        JsonInstanceSerializer<ZookeeperInstance> serializer =
+            new JsonInstanceSerializer<>(ZookeeperInstance.class);
+        ServiceDiscovery<ZookeeperInstance> dis = 
ServiceDiscoveryBuilder.builder(ZookeeperInstance.class)
+            .client(client)
+            .basePath(basePath + "/" + application)
+            .serializer(serializer)
+            .build();
+        ServiceCache<ZookeeperInstance> cache =
+            dis.serviceCacheBuilder().name(serviceName).build();
+        cache.addListener(new ServiceCacheListener() {
+          @Override
+          public void stateChanged(CuratorFramework curatorFramework, 
ConnectionState connectionState) {
+            LOGGER.warn("zookeeper discovery state changed {}", 
connectionState);
+          }
+
+          @Override
+          public void cacheChanged() {
+            instanceChangedListener.onInstanceChanged(name(), application, 
serviceName,
+                toDiscoveryInstances(cache.getInstances()));
+          }
+        });
+        try {
+          CountDownLatch latch = cache.startImmediate();
+          if (!latch.await(5000, TimeUnit.SECONDS)) {
+            throw new IllegalStateException("cache start failed.");
+          }
+        } catch (Exception e) {
+          throw new IllegalStateException(e);
+        }
+        return cache;
+      });
+      List<ServiceInstance<ZookeeperInstance>> instances = 
discovery.getInstances();
+      return toDiscoveryInstances(instances);
+    } catch (Exception e) {
+      throw new IllegalStateException(e);
+    }
+  }
+
+  private List<ZookeeperDiscoveryInstance> toDiscoveryInstances(
+      List<ServiceInstance<ZookeeperInstance>> instances) {
+    return instances.stream().map(instance ->
+        new 
ZookeeperDiscoveryInstance(instance.getPayload())).collect(Collectors.toList());
+  }
+
+  @Override
+  public void 
setInstanceChangedListener(InstanceChangedListener<ZookeeperDiscoveryInstance> 
instanceChangedListener) {
+    this.instanceChangedListener = instanceChangedListener;
+  }
+
+  @Override
+  public void init() {
+    String env = BootStrapProperties.readServiceEnvironment(environment);
+    if (StringUtils.isEmpty(env)) {
+      env = ZookeeperConst.ZOOKEEPER_DEFAULT_ENVIRONMENT;
+    }
+    basePath = String.format(ZookeeperConst.ZOOKEEPER_DISCOVERY_ROOT, env);
+  }
+
+  @Override
+  public void run() {
+    client = 
CuratorFrameworkFactory.newClient(zookeeperRegistryProperties.getConnectString(),
+        zookeeperRegistryProperties.getSessionTimeoutMills(), 
zookeeperRegistryProperties.getConnectionTimeoutMills(),
+        new ExponentialBackoffRetry(1000, 3));
+    client.start();
+  }
+
+  @Override
+  public void destroy() {
+    if (client != null) {
+      CloseableUtils.closeQuietly(client);
+    }
+  }
+
+  @Override
+  public boolean enabled() {
+    return zookeeperRegistryProperties.isEnabled();
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java
new file mode 100644
index 000000000..f33b05fb7
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+import org.apache.servicecomb.registry.api.DiscoveryInstance;
+import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus;
+
+public class ZookeeperDiscoveryInstance extends ZookeeperInstance implements 
DiscoveryInstance {
+  public ZookeeperDiscoveryInstance(ZookeeperInstance other) {
+    super(other);
+  }
+
+  @Override
+  public MicroserviceInstanceStatus getStatus() {
+    return MicroserviceInstanceStatus.UP;
+  }
+
+  @Override
+  public String getRegistryName() {
+    return ZookeeperConst.ZOOKEEPER_REGISTRY_NAME;
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java
new file mode 100644
index 000000000..725816b24
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.servicecomb.registry.api.DataCenterInfo;
+import org.apache.servicecomb.registry.api.MicroserviceInstance;
+
+public class ZookeeperInstance implements MicroserviceInstance {
+  private String serviceId;
+
+  private String instanceId;
+
+  private String environment;
+
+  private String application;
+
+  private String serviceName;
+
+  private String alias;
+
+  private String version;
+
+  private String description;
+
+  private DataCenterInfo dataCenterInfo;
+
+  private List<String> endpoints = new ArrayList<>();
+
+  private Map<String, String> schemas = new HashMap<>();
+
+  private Map<String, String> properties = new HashMap<>();
+
+  public ZookeeperInstance() {
+
+  }
+
+  public ZookeeperInstance(ZookeeperInstance other) {
+    this.serviceId = other.serviceId;
+    this.instanceId = other.instanceId;
+    this.environment = other.environment;
+    this.application = other.application;
+    this.serviceName = other.serviceName;
+    this.alias = other.alias;
+    this.version = other.version;
+    this.description = other.description;
+    this.dataCenterInfo = other.dataCenterInfo;
+    this.endpoints = other.endpoints;
+    this.schemas = other.schemas;
+    this.properties = other.properties;
+  }
+
+  public void setServiceId(String serviceId) {
+    this.serviceId = serviceId;
+  }
+
+  public void setInstanceId(String instanceId) {
+    this.instanceId = instanceId;
+  }
+
+  public void setEnvironment(String environment) {
+    this.environment = environment;
+  }
+
+  public void setApplication(String application) {
+    this.application = application;
+  }
+
+  public void setServiceName(String serviceName) {
+    this.serviceName = serviceName;
+  }
+
+  public void setAlias(String alias) {
+    this.alias = alias;
+  }
+
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+  public void setDataCenterInfo(DataCenterInfo dataCenterInfo) {
+    this.dataCenterInfo = dataCenterInfo;
+  }
+
+  public void setEndpoints(List<String> endpoints) {
+    this.endpoints = endpoints;
+  }
+
+  public void setSchemas(Map<String, String> schemas) {
+    this.schemas = schemas;
+  }
+
+  public void setProperties(Map<String, String> properties) {
+    this.properties = properties;
+  }
+
+  @Override
+  public String getEnvironment() {
+    return this.environment;
+  }
+
+  @Override
+  public String getApplication() {
+    return this.application;
+  }
+
+  @Override
+  public String getServiceName() {
+    return this.serviceName;
+  }
+
+  @Override
+  public String getAlias() {
+    return alias;
+  }
+
+  @Override
+  public String getVersion() {
+    return version;
+  }
+
+  @Override
+  public DataCenterInfo getDataCenterInfo() {
+    return dataCenterInfo;
+  }
+
+  @Override
+  public String getDescription() {
+    return description;
+  }
+
+  @Override
+  public Map<String, String> getProperties() {
+    return properties;
+  }
+
+  @Override
+  public Map<String, String> getSchemas() {
+    return schemas;
+  }
+
+  @Override
+  public List<String> getEndpoints() {
+    return endpoints;
+  }
+
+  public void addSchema(String schemaId, String content) {
+    this.schemas.put(schemaId, content);
+  }
+
+  public void addEndpoint(String endpoint) {
+    this.endpoints.add(endpoint);
+  }
+
+  public void addProperty(String key, String value) {
+    this.properties.put(key, value);
+  }
+
+  @Override
+  public String getInstanceId() {
+    return instanceId;
+  }
+
+  @Override
+  public String getServiceId() {
+    return serviceId;
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java
new file mode 100644
index 000000000..a69dfddb1
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+import java.lang.management.ManagementFactory;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.curator.utils.CloseableUtils;
+import org.apache.curator.x.discovery.ServiceDiscovery;
+import org.apache.curator.x.discovery.ServiceDiscoveryBuilder;
+import org.apache.curator.x.discovery.ServiceInstance;
+import org.apache.curator.x.discovery.details.JsonInstanceSerializer;
+import org.apache.servicecomb.config.BootStrapProperties;
+import org.apache.servicecomb.config.DataCenterProperties;
+import org.apache.servicecomb.registry.api.DataCenterInfo;
+import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus;
+import org.apache.servicecomb.registry.api.Registration;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+
+public class ZookeeperRegistration implements 
Registration<ZookeeperRegistrationInstance> {
+  private Environment environment;
+
+  private ZookeeperRegistryProperties zookeeperRegistryProperties;
+
+  private DataCenterProperties dataCenterProperties;
+
+  private String basePath;
+
+  private CuratorFramework client;
+
+  private ServiceInstance<ZookeeperInstance> instance;
+
+  @Autowired
+  @SuppressWarnings("unused")
+  public void setEnvironment(Environment environment) {
+    this.environment = environment;
+  }
+
+  @Autowired
+  @SuppressWarnings("unused")
+  public void setZookeeperRegistryProperties(ZookeeperRegistryProperties 
zookeeperRegistryProperties) {
+    this.zookeeperRegistryProperties = zookeeperRegistryProperties;
+  }
+
+  @Autowired
+  @SuppressWarnings("unused")
+  public void setDataCenterProperties(DataCenterProperties 
dataCenterProperties) {
+    this.dataCenterProperties = dataCenterProperties;
+  }
+
+  @Override
+  public void init() {
+    String env = BootStrapProperties.readServiceEnvironment(environment);
+    if (StringUtils.isEmpty(env)) {
+      env = ZookeeperConst.ZOOKEEPER_DEFAULT_ENVIRONMENT;
+    }
+    basePath = String.format(ZookeeperConst.ZOOKEEPER_DISCOVERY_ROOT, env);
+    ZookeeperInstance zookeeperInstance = new ZookeeperInstance();
+    zookeeperInstance.setInstanceId(buildInstanceId());
+    zookeeperInstance.setEnvironment(env);
+    
zookeeperInstance.setApplication(BootStrapProperties.readApplication(environment));
+    
zookeeperInstance.setServiceName(BootStrapProperties.readServiceName(environment));
+    
zookeeperInstance.setAlias(BootStrapProperties.readServiceAlias(environment));
+    
zookeeperInstance.setDescription(BootStrapProperties.readServiceDescription(environment));
+    if (StringUtils.isNotEmpty(dataCenterProperties.getName())) {
+      DataCenterInfo dataCenterInfo = new DataCenterInfo();
+      dataCenterInfo.setName(dataCenterProperties.getName());
+      dataCenterInfo.setRegion(dataCenterProperties.getRegion());
+      dataCenterInfo.setAvailableZone(dataCenterProperties.getAvailableZone());
+      zookeeperInstance.setDataCenterInfo(dataCenterInfo);
+    }
+    
zookeeperInstance.setProperties(BootStrapProperties.readServiceProperties(environment));
+    
zookeeperInstance.setVersion(BootStrapProperties.readServiceVersion(environment));
+    try {
+      this.instance = 
ServiceInstance.<ZookeeperInstance>builder().name(zookeeperInstance.getServiceName())
+          
.id(zookeeperInstance.getInstanceId()).payload(zookeeperInstance).build();
+    } catch (Exception e) {
+      throw new IllegalStateException(e);
+    }
+  }
+
+  @Override
+  public void run() {
+    client = 
CuratorFrameworkFactory.newClient(zookeeperRegistryProperties.getConnectString(),
+        zookeeperRegistryProperties.getSessionTimeoutMills(), 
zookeeperRegistryProperties.getConnectionTimeoutMills(),
+        new ExponentialBackoffRetry(1000, 3));
+    client.start();
+    JsonInstanceSerializer<ZookeeperInstance> serializer =
+        new JsonInstanceSerializer<>(ZookeeperInstance.class);
+    ServiceDiscovery<ZookeeperInstance> dis = 
ServiceDiscoveryBuilder.builder(ZookeeperInstance.class)
+        .client(client)
+        .basePath(basePath + "/" + 
BootStrapProperties.readApplication(environment))
+        .serializer(serializer)
+        .thisInstance(instance)
+        .build();
+    try {
+      dis.start();
+    } catch (Exception e) {
+      throw new IllegalStateException(e);
+    }
+  }
+
+  @Override
+  public void destroy() {
+    if (client != null) {
+      CloseableUtils.closeQuietly(client);
+    }
+  }
+
+  @Override
+  public String name() {
+    return ZookeeperConst.ZOOKEEPER_REGISTRY_NAME;
+  }
+
+  @Override
+  public ZookeeperRegistrationInstance getMicroserviceInstance() {
+    return new ZookeeperRegistrationInstance(instance.getPayload());
+  }
+
+  @Override
+  public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus 
status) {
+    // not support yet
+    return true;
+  }
+
+  @Override
+  public void addSchema(String schemaId, String content) {
+    if (zookeeperRegistryProperties.isEnableSwaggerRegistration()) {
+      instance.getPayload().addSchema(schemaId, content);
+    }
+  }
+
+  @Override
+  public void addEndpoint(String endpoint) {
+    instance.getPayload().addEndpoint(endpoint);
+  }
+
+  @Override
+  public void addProperty(String key, String value) {
+    instance.getPayload().addProperty(key, value);
+  }
+
+  @Override
+  public boolean enabled() {
+    return zookeeperRegistryProperties.isEnabled();
+  }
+
+  private static String buildInstanceId() {
+    return System.currentTimeMillis() + "-" + 
ManagementFactory.getRuntimeMXBean().getPid();
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java
new file mode 100644
index 000000000..6c098705b
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus;
+import org.apache.servicecomb.registry.api.RegistrationInstance;
+
+public class ZookeeperRegistrationInstance extends ZookeeperInstance 
implements RegistrationInstance {
+  public ZookeeperRegistrationInstance(ZookeeperInstance instance) {
+    super(instance);
+  }
+
+  @Override
+  public MicroserviceInstanceStatus getInitialStatus() {
+    return MicroserviceInstanceStatus.STARTING;
+  }
+
+  @Override
+  public MicroserviceInstanceStatus getReadyStatus() {
+    return MicroserviceInstanceStatus.UP;
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistryProperties.java
 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistryProperties.java
new file mode 100644
index 000000000..b67bac238
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistryProperties.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.registry.zookeeper;
+
+public class ZookeeperRegistryProperties {
+  private boolean enabled = true;
+
+  private boolean ephemeral = true;
+
+  private String connectString = "zookeeper://127.0.0.1:2181";
+
+  private int connectionTimeoutMills = 1000;
+
+  private int sessionTimeoutMills = 60000;
+
+  private boolean enableSwaggerRegistration = false;
+
+  public boolean isEnabled() {
+    return enabled;
+  }
+
+  public void setEnabled(boolean enabled) {
+    this.enabled = enabled;
+  }
+
+  public boolean isEphemeral() {
+    return ephemeral;
+  }
+
+  public void setEphemeral(boolean ephemeral) {
+    this.ephemeral = ephemeral;
+  }
+
+  public String getConnectString() {
+    return connectString;
+  }
+
+  public void setConnectString(String connectString) {
+    this.connectString = connectString;
+  }
+
+  public int getConnectionTimeoutMills() {
+    return connectionTimeoutMills;
+  }
+
+  public void setConnectionTimeoutMills(int connectionTimeoutMills) {
+    this.connectionTimeoutMills = connectionTimeoutMills;
+  }
+
+  public int getSessionTimeoutMills() {
+    return sessionTimeoutMills;
+  }
+
+  public void setSessionTimeoutMills(int sessionTimeoutMills) {
+    this.sessionTimeoutMills = sessionTimeoutMills;
+  }
+
+  public boolean isEnableSwaggerRegistration() {
+    return enableSwaggerRegistration;
+  }
+
+  public void setEnableSwaggerRegistration(boolean enableSwaggerRegistration) {
+    this.enableSwaggerRegistration = enableSwaggerRegistration;
+  }
+}
diff --git 
a/service-registry/registry-zookeeper/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
 
b/service-registry/registry-zookeeper/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 000000000..3fd671eac
--- /dev/null
+++ 
b/service-registry/registry-zookeeper/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+org.apache.servicecomb.registry.zookeeper.ZookeeperConfiguration


Reply via email to