You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by hu...@apache.org on 2019/08/16 07:22:12 UTC

[dubbo-samples] branch master updated: add dubbo samples for tengine dubbo

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

huxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git


The following commit(s) were added to refs/heads/master by this push:
     new 39be20e  add dubbo samples for tengine dubbo
     new 5c31d94  Merge pull request #111 from MengqiWu/master
39be20e is described below

commit 39be20e5f5875b4dcd5dd524c25cc2eca66f1ca1
Author: hanshu <me...@alibaba-inc.com>
AuthorDate: Fri Aug 16 14:39:51 2019 +0800

    add dubbo samples for tengine dubbo
---
 dubbo-samples-tengine/README.md                    | 175 +++++++++++++++++
 .../dubbo-samples-tengine-interface/pom.xml        |  29 +++
 .../apache/dubbo/samples/tengine/DemoService.java  |  43 +++++
 .../dubbo-samples-tengine-provider/pom.xml         |  80 ++++++++
 .../samples/tengine/provider/DemoServiceImpl.java  | 213 +++++++++++++++++++++
 .../dubbo/samples/tengine/provider/Provider.java   |  33 ++++
 .../META-INF/spring/dubbo-demo-provider.xml        |  39 ++++
 .../src/main/resources/dubbo.properties            |   1 +
 .../src/main/resources/log4j.properties            |   7 +
 dubbo-samples-tengine/pom.xml                      |  80 ++++++++
 10 files changed, 700 insertions(+)

diff --git a/dubbo-samples-tengine/README.md b/dubbo-samples-tengine/README.md
new file mode 100644
index 0000000..5693f53
--- /dev/null
+++ b/dubbo-samples-tengine/README.md
@@ -0,0 +1,175 @@
+# Quick Start
+
+## Install Tengine
+
+### Get Tengine
+```
+git clone https://github.com/alibaba/tengine.git
+```
+### Get some other vendor
+```
+cd ./tengine
+
+wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
+tar xvf pcre-8.43.tar.gz
+
+wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz
+tar xvf openssl-1.0.2s.tar.gz
+
+wget http://www.zlib.net/zlib-1.2.11.tar.gz
+tar xvf zlib-1.2.11.tar.gz
+```
+
+### Build Tengine
+```
+./configure --add-module=./modules/mod_dubbo --add-module=./modules/ngx_multi_upstream_module --add-module=./modules/mod_config --with-pcre=./pcre-8.43/ --with-openssl=./openssl-1.0.2s/ --with-zlib=./zlib-1.2.11
+make
+sudo make install
+```
+
+CentOS maybe need
+```
+sudo yum install gcc
+sudo yum install gcc-c++
+```
+
+### Run Tengine
+
+modify tengine config file ```/usr/local/nginx/conf/nginx.conf``` to 
+
+```
+worker_processes  1;
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    sendfile        on;
+
+    server {
+        listen       8080;
+        server_name  localhost;
+        
+        #pass the Dubbo to Dubbo Provider server listening on 127.0.0.1:20880
+        location / {
+            dubbo_pass_all_headers on;
+            dubbo_pass_set args $args;
+            dubbo_pass_set uri $uri;
+            dubbo_pass_set method $request_method;
+        
+            dubbo_pass org.apache.dubbo.samples.tengine.DemoService 0.0.0 tengineDubbo dubbo_backend;
+        }
+    }
+
+    #pass the Dubbo to Dubbo Provider server listening on 127.0.0.1:20880
+    upstream dubbo_backend {
+        multi 1;
+        server 127.0.0.1:20880;
+    }
+}
+```
+
+### Start Tengine
+
+```
+/usr/local/nginx/sbin/nginx
+```
+
+Other Commond (no need execute usual)
+```
+#restart
+/usr/local/nginx/sbin/nginx -s reload
+#stop
+/usr/local/nginx/sbin/nginx -s stop
+```
+
+### More document
+```
+https://github.com/alibaba/tengine/blob/master/docs/modules/ngx_http_dubbo_module.md
+https://github.com/alibaba/tengine/blob/master/docs/modules/ngx_http_dubbo_module_cn.md
+```
+
+## Install Dubbo
+### Get Dubbo Samples
+
+```
+git clone https://github.com/apache/dubbo-samples.git
+```
+
+### Build Dubbo Tengine Sample
+depend on ```maven``` and ```jdk8```
+
+```
+cd ./dubbo-samples/dubbo-samples-tengine
+mvn package
+```
+
+CentOS maybe need
+```
+sudo yum install maven
+
+#or
+
+wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
+sudo yum -y install apache-maven
+
+
+sudo yum install java-1.8.0-openjdk-devel
+```
+
+Ubuntu maybe need
+```
+sudo apt install maven
+sudo apt install openjdk-8-jdk-devel
+
+#some times
+sudo apt-get install software-properties-common
+sudo add-apt-repository ppa:openjdk-r/ppa
+sudo apt-get update
+sudo apt-get install openjdk-8-jdk
+sudo update-alternatives --config java
+```
+
+### Run Dubbo Demo
+```
+cd dubbo-samples-tengine-provider/target/
+java -Djava.net.preferIPv4Stack=true -jar dubbo-demo-provider.one-jar.jar
+```
+
+
+## Do Test
+
+```
+curl http://127.0.0.1:8080/dubbo -i
+```
+
+Like this
+
+```
+curl http://127.0.0.1:8080/dubbo -i
+
+HTTP/1.1 200 OK
+Server: Tengine/2.3.1
+Date: Thu, 15 Aug 2019 05:42:15 GMT
+Content-Type: application/octet-stream
+Content-Length: 13
+Connection: keep-alive
+test: 123
+
+dubbo success
+```
+
+This doc Verified on
+```
+Ubuntu 14.04
+Ubuntu 16.04
+Ubuntu 18.04
+
+Centos 7
+Centos 6
+```
\ No newline at end of file
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-interface/pom.xml b/dubbo-samples-tengine/dubbo-samples-tengine-interface/pom.xml
new file mode 100644
index 0000000..4ba9fdb
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-interface/pom.xml
@@ -0,0 +1,29 @@
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.dubbo.sample</groupId>
+        <artifactId>dubbo-samples-tengine</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.dubbo.sample</groupId>
+    <artifactId>dubbo-samples-tengine-interface</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>${project.artifactId}</name>
+    <description>The demo module of tengine dubbo</description>
+    <properties>
+        <skip_maven_deploy>true</skip_maven_deploy>
+    </properties>
+    <build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+                <source>1.8</source>
+                <target>1.8</target>
+            </configuration>
+        </plugin>
+    </plugins>
+    </build>
+</project>
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-interface/src/main/java/org/apache/dubbo/samples/tengine/DemoService.java b/dubbo-samples-tengine/dubbo-samples-tengine-interface/src/main/java/org/apache/dubbo/samples/tengine/DemoService.java
new file mode 100644
index 0000000..591332b
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-interface/src/main/java/org/apache/dubbo/samples/tengine/DemoService.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.dubbo.samples.tengine;
+
+import java.util.Map;
+
+public interface DemoService {;
+
+    /**
+     * standard samples tengine dubbo infterace demo
+     * @param context tengine pass http infos
+     * @return Map<String, Object></> pass to tengine response http
+     **/
+    Map<String, Object> tengineDubbo(Map<String, Object> context);
+
+    /**
+     * a test sample for dubbo to http invoke
+     * @param context tengine pass http infos
+     * @return Map<String, Object></> pass to tengine response http
+     **/
+    Map<String, Object> dubbo2Http(Map<String, Object> context);
+
+    /**
+     * a test for dubbo boundary case
+     * @param context tengine pass http infos
+     * @return Map<String, Object></> pass to tengine response http
+     **/
+    Map<String, Object> tengineTest(Map<String, Object> context);
+}
\ No newline at end of file
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml b/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml
new file mode 100644
index 0000000..38fd94a
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml
@@ -0,0 +1,80 @@
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.dubbo.sample</groupId>
+        <artifactId>dubbo-samples-tengine</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.dubbo.sample</groupId>
+    <artifactId>dubbo-samples-tengine-provider</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>${project.artifactId}</name>
+    <description>The demo provider module of dubbo tengine</description>
+    <properties>
+        <skip_maven_deploy>true</skip_maven_deploy>
+        <slf4j-log4j12.version>1.7.25</slf4j-log4j12.version>
+        <curator.version>2.12.0</curator.version>
+        <dubbo.version>2.7.3</dubbo.version>
+    </properties>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.dubbo.sample</groupId>
+            <artifactId>dubbo-samples-tengine-interface</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo</artifactId>
+            <version>${dubbo.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.5</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>dubbo-demo-provider</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>org.apache.dubbo.samples.tengine.provider.Provider</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>com.jolira</groupId>
+                <artifactId>onejar-maven-plugin</artifactId>
+                <version>1.4.4</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>one-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java
new file mode 100644
index 0000000..c37409d
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java
@@ -0,0 +1,213 @@
+/*
+ * 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.dubbo.samples.tengine.provider;
+
+import org.apache.dubbo.samples.tengine.DemoService;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.util.EntityUtils;
+
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class DemoServiceImpl implements DemoService {
+    @Override
+    public Map<String, Object> tengineDubbo(Map<String, Object> context) {
+        for (Map.Entry<String, Object> entry : context.entrySet()) {
+            System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
+        }
+
+        Map<String, Object> ret = new HashMap<String, Object>();
+        ret.put("body", "dubbo success\n");
+        ret.put("status", "200");
+        ret.put("test", "123");
+
+        return ret;
+    }
+
+    @Override
+    //a sample for dubbo to http test
+    public Map<String, Object>  dubbo2Http(Map<String, Object> context) {
+        for (Map.Entry<String, Object> entry : context.entrySet()) {
+            System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
+        }
+
+        String destUrl = "http://127.0.0.1:9280";
+
+        Map<String, Object> ret = null;
+        String testValue = (String)context.get("test");
+        if (testValue != null) {
+            System.out.println("test value: " + testValue);
+            ret = new HashMap<String, Object>();
+            if (testValue.equals("null")) {
+                System.out.println("dubbo test: null");
+                return null;
+            } else if (testValue.equals("body empty")) {
+                System.out.println("dubbo test: body empty");
+                ret.put("status", "302");
+            } else if (testValue.equals("status empty")) {
+                System.out.println("dubbo test: status empty");
+                ret.put("body", "dubbo failed");
+            } else {
+                System.out.println("dubbo test: unkown test");
+            }
+
+            return ret;
+        }
+
+        //prepare params
+        String method = null;
+        String url = null;
+        byte[] body = null;
+        List<NameValuePair> params = null;
+        Map<String, String> headers = new HashMap<String, String>();
+        for (Map.Entry<String, Object> entry : context.entrySet()) {
+            String key = entry.getKey();
+            Object value = entry.getValue();
+            System.out.println("get key = " + key + ", value = " + value);
+            if (key.equals("args")) {
+                params = URLEncodedUtils.parse((String)value, Charset.forName("UTF-8"));
+            } else if (key.equals("method")) {
+                method = (String)value;
+            } else if (key.equals("body")) {
+                body = (byte[])value;
+            } else if (key.equals("uri")) {
+                url = destUrl + value;
+            } else {
+                headers.put(key, (String)value);
+            }
+        }
+
+        //do http request
+        ret = sendRequest(url, method, params, headers, body);
+
+        return ret;
+    }
+
+    Map<String, Object> sendRequest(String url, String method, List<NameValuePair> params, Map<String, String> headers, byte[] body) {
+        Map<String, Object> result = new HashMap<String, Object>();
+
+        CloseableHttpClient client = null;
+        CloseableHttpResponse response = null;
+        try{
+            client = HttpClients.createDefault();
+
+            URIBuilder uriBuilder = new URIBuilder(url);
+
+            uriBuilder.addParameters(params);
+
+            System.out.println("get to: " + uriBuilder.build().toString());
+
+            HttpRequestBase request = null;
+
+            if (method.equals("GET")) {
+                request = new HttpGet(uriBuilder.build());
+            } else if (method.equals("POST")) {
+                request = new HttpPost(uriBuilder.build());
+                if (body != null) {
+                    HttpEntity entity = new ByteArrayEntity(body);
+                    ((HttpPost)request).setEntity(entity);
+                }
+            } else {
+                result.put("status", "500");
+                return result;
+            }
+
+            for (Map.Entry<String, String> entry : headers.entrySet()) {
+                System.out.println("header key = " + entry.getKey() + ", value = " + entry.getValue());
+                if (entry.getKey().equalsIgnoreCase("content-length")) {
+                    System.out.println("skip content-length");
+                    continue;
+                }
+                request.setHeader(new BasicHeader(entry.getKey(), entry.getValue()));
+            }
+
+            RequestConfig.Builder reqConf = RequestConfig.custom();
+            reqConf.setRedirectsEnabled(false);
+            request.setConfig(reqConf.build());
+
+            response = client.execute(request);
+
+            int statusCode = response.getStatusLine().getStatusCode();
+            result.put("status", String.valueOf(statusCode));
+
+            HttpEntity entity = response.getEntity();
+
+            byte[] responseBody = EntityUtils.toByteArray(entity);
+            result.put("body", responseBody);
+
+            System.out.println("body byte");
+
+            Header[] responseHeaders = response.getAllHeaders();
+            for (Header h : responseHeaders) {
+                System.out.println("header key = " + h.getName() + ", value = " + h.getValue());
+                result.put(h.getName(), h.getValue());
+            }
+        }catch (Exception e){
+            System.out.println("error: " + e.getCause().getMessage());
+            e.printStackTrace();
+            result.put("status", "502");
+            result.put("body", e.getCause().getMessage().getBytes());
+        }
+
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> tengineTest(Map<String, Object> context) {
+        for (Map.Entry<String, Object> entry : context.entrySet()) {
+            System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
+        }
+
+        Map<String, Object> ret = null;
+        String testValue = (String)context.get("test");
+        if (testValue != null) {
+            System.out.println("test value: " + testValue);
+            ret = new HashMap<String, Object>();
+            if (testValue.equals("null")) {
+                System.out.println("dubbo test: null");
+                return null;
+            } else if (testValue.equals("body empty")) {
+                System.out.println("dubbo test: body empty");
+                ret.put("status", "302");
+            } else if (testValue.equals("status empty")) {
+                System.out.println("dubbo test: status empty");
+                ret.put("body", "dubbo failed");
+            } else {
+                System.out.println("dubbo test: unkown test");
+            }
+
+            return ret;
+        }
+
+        return null;
+    }
+}
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.java b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.java
new file mode 100644
index 0000000..edc5793
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.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.dubbo.samples.tengine.provider;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class Provider {
+
+    /**
+     * To get ipv6 address to work, add
+     * System.setProperty("java.net.preferIPv6Addresses", "true");
+     * before running your application.
+     */
+    public static void main(String[] args) throws Exception {
+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo-demo-provider.xml"});
+        context.start();
+        System.in.read(); // press any key to exit
+    }
+}
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
new file mode 100644
index 0000000..339e3cc
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
@@ -0,0 +1,39 @@
+<?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.
+  -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+       http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
+
+    <!-- provider's application name, used for tracing dependency relationship -->
+    <dubbo:application name="demo-provider"/>
+
+    <!-- use multicast registry center to export service -->
+    <dubbo:registry address="multicast://224.5.6.7:1234"/>
+
+    <!-- use dubbo protocol to export service on port 20880 -->
+    <dubbo:protocol name="dubbo" port="20880" threads="1024"/>
+    
+    <!-- service implementation, as same as regular local bean -->
+    <bean id="demoService" class="org.apache.dubbo.samples.tengine.provider.DemoServiceImpl"/>
+
+    <!-- declare the service interface to be exported -->
+    <dubbo:service interface="org.apache.dubbo.samples.tengine.DemoService" ref="demoService"/>
+
+</beans>
\ No newline at end of file
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/dubbo.properties b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/dubbo.properties
new file mode 100644
index 0000000..ad602ba
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/dubbo.properties
@@ -0,0 +1 @@
+dubbo.application.qos.port=22222
diff --git a/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/log4j.properties b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/log4j.properties
new file mode 100644
index 0000000..15a0900
--- /dev/null
+++ b/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-tengine/pom.xml b/dubbo-samples-tengine/pom.xml
new file mode 100644
index 0000000..a082ad3
--- /dev/null
+++ b/dubbo-samples-tengine/pom.xml
@@ -0,0 +1,80 @@
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.dubbo.sample</groupId>
+    <artifactId>dubbo-samples-tengine</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>${project.artifactId}</name>
+    <description>The demo module of tengine dubbo</description>
+    <properties>
+        <skip_maven_deploy>true</skip_maven_deploy>
+    </properties>
+    <modules>
+        <module>dubbo-samples-tengine-interface</module>
+        <module>dubbo-samples-tengine-provider</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Spring Boot -->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>2.1.5.RELEASE</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.dubbo</groupId>
+                <artifactId>dubbo-dependencies-bom</artifactId>
+                <version>2.7.3</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.dubbo</groupId>
+                <artifactId>dubbo</artifactId>
+                <version>2.7.3</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.springframework</groupId>
+                        <artifactId>spring</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.servlet</groupId>
+                        <artifactId>servlet-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>log4j</groupId>
+                        <artifactId>log4j</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <dependencies>
+        <!-- Spring Boot dependencies -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <version>2.1.5.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-spring-boot-starter</artifactId>
+            <version>2.7.1</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <configuration>
+                        <source>1.8</source>
+                        <target>1.8</target>
+                    </configuration>
+                </plugin>
+        </plugins>
+    </build>
+</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org