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

liujun 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 01786ab62 add a case for dubbo-samples-gateway-apisix-dubbo (#1141)
01786ab62 is described below

commit 01786ab6241455b34af444eb9da990a10e0fc1e3
Author: MiSinG <115055044+mming...@users.noreply.github.com>
AuthorDate: Wed Apr 24 00:25:50 2024 +0800

    add a case for dubbo-samples-gateway-apisix-dubbo (#1141)
---
 .../dubbo-samples-gateway-apisix-dubbo/README.md   | 115 ++++++++++++++++++++
 .../docker-compose.yml                             | 118 ++++++++++++++++++++
 .../pom.xml                                        |  73 +++++++++++++
 .../gateway/consumer/ConsumerApplication.java      |  31 ++++++
 .../dubbo/samples/gateway/consumer/Task.java       |  48 +++++++++
 .../src/main/resources/application.yml             |  28 +++++
 .../pom.xml                                        |  38 +++++++
 .../apache/dubbo/samples/api/ApisixService.java    |  25 +++++
 .../org/apache/dubbo/samples/api/DemoService.java  |  23 ++++
 .../pom.xml                                        | 100 +++++++++++++++++
 .../gateway/provider/ApisixServiceImpl.java        |  43 ++++++++
 .../samples/gateway/provider/DemoServiceImpl.java  |  28 +++++
 .../gateway/provider/ProviderApplication.java      |  30 ++++++
 .../src/main/resources/application.yml             |  27 +++++
 .../dubbo-samples-gateway-apisix-dubbo/pom.xml     | 119 +++++++++++++++++++++
 .../dubbo-samples-gateway-apisix/pom.xml           |  50 +++++++++
 2-advanced/dubbo-samples-gateway/pom.xml           |   1 +
 2-advanced/pom.xml                                 |   1 +
 18 files changed, 898 insertions(+)

diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md
new file mode 100644
index 000000000..fb34b3d3a
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md
@@ -0,0 +1,115 @@
+# Using APISIX+Nacos to Proxy Dubbo Service
+
+### Installation
+
+You can choose any of the following ways to install APISIX:
+
+- Docker
+- Helm
+- RPM
+- DEB
+- Source Code
+
+This document uses Docker installation, which is relatively simple
+
+To install APISIX using this method, you need to install 
[Docker](https://www.docker.com/) And  
+
+[docker-compose](https://docs.docker.com/compose/)
+
+First, download [apisix-docker](https://github.com/apache/apisix-docker) 
Warehouse.
+
+`git clone https://github.com/apache/apisix-docker.git`
+
+`cd apisix-docker/example`
+
+### Configuration
+
+Next, enable the dubbo proxy plugin in the config.yaml file
+
+`cd apisix-docker/example/apisix_conf/`
+
+```yaml
+# Add this in config.yaml
+plugins:
+  - ... # plugin you need
+  - dubbo-proxy
+```
+
+Then note that due to the need to connect to the Nacos registry, it is 
necessary to modify the 
+
+`cd apisix-docker/example`
+
+`vi docker-compose.yml` 
+Add the following content
+
+```yaml
+  nacos:
+    image: nacos/nacos-server:v2.1.1
+    container_name: nacos-standalone
+    environment:
+    - PREFER_HOST_MODE=hostname
+    - MODE=standalone
+    ports:
+    - "8848:8848"
+    - "9848:9848"
+    networks:
+      apisix:
+```
+
+Finally, use Docker Compose to enable APISIX: 
+
+`docker-compose -p docker-apisix up -d`
+
+### Access
+
+The code example can use the `dubbo-samples-gateway-apisix-dubbo` module under 
the `dubbo samples gateway` module
+Create an Upstream pointing to Dubbo Provider using curl.
+
+```yaml
+curl 
[http://127.0.0.1:9180/apisix/admin/upstreams/1](http://127.0.0.1:9180/apisix/admin/upstreams/1)
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "nodes": {
+        "10.21.32.168:20880": 1
+    },
+    "type": "roundrobin",
+    "discovery_type": "nacos"
+}'
+```
+
+Expose an HTTP route for ApisixService
+
+```yaml
+curl 
[http://127.0.0.1:9180/apisix/admin/routes/1](http://127.0.0.1:9180/apisix/admin/routes/1)
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uris": [
+        "/dubbo"
+    ],
+    "plugins": {
+        "dubbo-proxy": {
+            "service_name": "org.apache.dubbo.samples.api.ApisixService",
+            "service_version": "0.0.0",
+            "method": "apisixToDubbo"
+        }
+    },
+    "upstream_id": 1
+}'
+```
+
+Use the curl command to request Apache APISIX and view the returned results.
+
+```bash
+curl http://127.0.0.1:9080/dubbo -H "Host: example.org"  -X POST --data 
'{"name": "hello"}'
+```
+
+```bash
+dubbo success
+
+Key = accept-language, Value = zh-CN,zh;q=0.8
+Key = host, Value = 10.21.32.168:9080
+Key = connection, Value = keep-alive
+Key = accept-encoding, Value = gzip, deflate
+Key = accept, Value = 
text/html,application/json,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Key = user-agent, Value = Mozilla/5.0 (Windows NT 10.0; Win64; x64) 
AppleWebKit/53
+```
+
+At this point, the most basic use of the Apisix proxy dubbo service sample has 
been completed
\ No newline at end of file
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/docker-compose.yml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/docker-compose.yml
new file mode 100644
index 000000000..779faa49f
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/docker-compose.yml
@@ -0,0 +1,118 @@
+#
+# 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.
+#
+
+version: "3"
+
+services:
+  apisix:
+    image: apache/apisix:${APISIX_IMAGE_TAG:-3.9.0-debian}
+    restart: always
+    volumes:
+      - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
+    depends_on:
+      - etcd
+    ##network_mode: host
+    ports:
+      - "9180:9180/tcp"
+      - "9080:9080/tcp"
+      - "9091:9091/tcp"
+      - "9443:9443/tcp"
+      - "9092:9092/tcp"
+    networks:
+      apisix:
+
+  etcd:
+    image: bitnami/etcd:3.5.11
+    restart: always
+    volumes:
+      - etcd_data:/bitnami/etcd
+    environment:
+      ETCD_ENABLE_V2: "true"
+      ALLOW_NONE_AUTHENTICATION: "yes"
+      ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379";
+      ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379";
+    ports:
+      - "2379:2379/tcp"
+    networks:
+      apisix:
+
+
+  nacos:
+    image: nacos/nacos-server:v2.1.1
+    container_name: nacos-standalone
+    environment:
+    - PREFER_HOST_MODE=hostname
+    - MODE=standalone
+    ports:
+    - "8848:8848"
+    - "9848:9848"
+    networks:
+      apisix:
+
+  web1:
+    image: nginx:1.19.0-alpine
+    restart: always
+    volumes:
+      - ./upstream/web1.conf:/etc/nginx/nginx.conf
+    ports:
+      - "9081:80/tcp"
+    environment:
+      - NGINX_PORT=80
+    networks:
+      apisix:
+
+  web2:
+    image: nginx:1.19.0-alpine
+    restart: always
+    volumes:
+      - ./upstream/web2.conf:/etc/nginx/nginx.conf
+    ports:
+      - "9082:80/tcp"
+    environment:
+      - NGINX_PORT=80
+    networks:
+      apisix:
+
+  prometheus:
+    image: prom/prometheus:v2.25.0
+    restart: always
+    volumes:
+      - ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml
+    ports:
+      - "9090:9090"
+    networks:
+      apisix:
+
+  grafana:
+    image: grafana/grafana:7.3.7
+    restart: always
+    ports:
+      - "3000:3000"
+    volumes:
+      - "./grafana_conf/provisioning:/etc/grafana/provisioning"
+      - "./grafana_conf/dashboards:/var/lib/grafana/dashboards"
+      - "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini"
+    networks:
+      apisix:
+
+networks:
+  apisix:
+    driver: bridge
+
+volumes:
+  etcd_data:
+    driver: local
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml
new file mode 100644
index 000000000..8fcf57393
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml
@@ -0,0 +1,73 @@
+<?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.dubbo</groupId>
+        <artifactId>dubbo-samples-gateway-apisix-dubbo</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>dubbo-samples-gateway-apisix-dubbo-consumer</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+
+        <!-- dubbo -->
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- spring starter -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            
<artifactId>dubbo-samples-gateway-apisix-dubbo-interface</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java
new file mode 100644
index 000000000..5cac7b9b2
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java
@@ -0,0 +1,31 @@
+/*
+ * 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.gateway.consumer;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+
+@SpringBootApplication
+@EnableDubbo
+public class ConsumerApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ConsumerApplication.class, args);
+    }
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java
new file mode 100644
index 000000000..aee203409
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java
@@ -0,0 +1,48 @@
+/*
+ * 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.gateway.consumer;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.samples.api.DemoService;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+import java.util.Date;
+
+@Component
+public class Task implements CommandLineRunner {
+
+    @DubboReference
+    private DemoService demoService;
+
+    @Override
+    public void run(String... args) throws Exception {
+        String result = demoService.sayHello("world");
+        System.out.println("Receive result ======> " + result);
+
+        new Thread(()-> {
+            while (true) {
+                try {
+                    Thread.sleep(1000);
+                    System.out.println(new Date() + " Receive result ======> " 
+ demoService.sayHello("world"));
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                    Thread.currentThread().interrupt();
+                }
+            }
+        }).start();
+    }
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/resources/application.yml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/resources/application.yml
new file mode 100644
index 000000000..4ec769ba4
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/resources/application.yml
@@ -0,0 +1,28 @@
+# 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.
+
+server:
+    port: 8889
+dubbo:
+    application:
+        name: dubbo-gateway-consumer
+    protocol:
+        name: dubbo
+        port: 20880
+        serialization: fastjson2
+    registry:
+        address: nacos://${nacos.address:127.0.0.1}:8848
+        username: nacos
+        password: nacos
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/pom.xml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/pom.xml
new file mode 100644
index 000000000..e84f205a1
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/pom.xml
@@ -0,0 +1,38 @@
+<?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.dubbo</groupId>
+        <artifactId>dubbo-samples-gateway-apisix-dubbo</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>dubbo-samples-gateway-apisix-dubbo-interface</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/ApisixService.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/ApisixService.java
new file mode 100644
index 000000000..cd71f6a11
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/ApisixService.java
@@ -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.
+ */
+package org.apache.dubbo.samples.api;
+
+import java.util.Map;
+
+public interface ApisixService {
+
+    Map<String, Object> apisixToDubbo(Map<String, Object> requestBody);
+
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java
new file mode 100644
index 000000000..202775d89
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java
@@ -0,0 +1,23 @@
+/*
+ * 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.api;
+
+public interface DemoService {
+
+    String sayHello(String name);
+
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml
new file mode 100644
index 000000000..1e151d569
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml
@@ -0,0 +1,100 @@
+<?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.dubbo</groupId>
+        <artifactId>dubbo-samples-gateway-apisix-dubbo</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>dubbo-samples-gateway-apisix-dubbo-provider</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <!-- dubbo -->
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- spring starter -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            
<artifactId>dubbo-samples-gateway-apisix-dubbo-interface</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-registry-nacos</artifactId>
+            <version>${dubbo-nacos.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.dubbo</groupId>
+                    <artifactId>dubbo-registry-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.dubbo</groupId>
+                    <artifactId>dubbo-common</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
+            <version>2.0.39</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ApisixServiceImpl.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ApisixServiceImpl.java
new file mode 100644
index 000000000..ebc5bcc0b
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ApisixServiceImpl.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.gateway.provider;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.api.ApisixService;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@DubboService
+public class ApisixServiceImpl implements ApisixService {
+
+    @Override
+    public Map<String, Object> apisixToDubbo(Map<String, Object> requestBody) {
+        for (Map.Entry<String, Object> entry : requestBody.entrySet()) {
+            //Notice here that the value of the body is actually a byte array
+            System.out.println("Key = " + entry.getKey() + ", Value = " + 
entry.getValue());
+        }
+
+        Map<String, Object> resp = new HashMap<>();
+        resp.put("body", "dubbo success\n"); // http response body
+        resp.put("status", "200"); // http response status
+        resp.put("author", "yang siming"); // http response header
+
+        return resp;
+    }
+
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java
new file mode 100644
index 000000000..e875f4d0d
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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.gateway.provider;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.api.DemoService;
+
+
+@DubboService
+public class DemoServiceImpl implements DemoService {
+    public String sayHello(String name) {
+        return "Hello " + name;
+    }
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java
new file mode 100644
index 000000000..6c6f9e806
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java
@@ -0,0 +1,30 @@
+/*
+ * 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.gateway.provider;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class ProviderApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(ProviderApplication.class, args);
+    }
+}
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml
new file mode 100644
index 000000000..af3290405
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml
@@ -0,0 +1,27 @@
+# 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.
+server:
+    port: 8888
+dubbo:
+    application:
+        name: dubbo-gateway-provider
+    protocol:
+        name: dubbo
+        port: 20880
+        serialization: fastjson2
+    registry:
+        address: nacos://${nacos.address:127.0.0.1}:8848
+        username: nacos
+        password: nacos
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml
 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml
new file mode 100644
index 000000000..21cd99fec
--- /dev/null
+++ 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml
@@ -0,0 +1,119 @@
+<?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.dubbo</groupId>
+        <artifactId>dubbo-samples-gateway-apisix</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>dubbo-samples-gateway-apisix-dubbo</artifactId>
+    <name>Dubbo Samples Gateway Apisix Dubbo</name>
+    <description>Dubbo Samples Gateway Apisix Dubbo</description>
+    <packaging>pom</packaging>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <spring-boot.version>3.2.3</spring-boot.version>
+        <dubbo.version>3.3.0-beta.1</dubbo.version>
+        <dubbo-nacos.version>3.2.0</dubbo-nacos.version>
+    </properties>
+    <modules>
+        <module>dubbo-samples-gateway-apisix-dubbo-consumer</module>
+        <module>dubbo-samples-gateway-apisix-dubbo-interface</module>
+        <module>dubbo-samples-gateway-apisix-dubbo-provider</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter</artifactId>
+                <version>${spring-boot.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <artifactId>spring-boot-starter-logging</artifactId>
+                        <groupId>org.springframework.boot</groupId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.dubbo</groupId>
+                <artifactId>dubbo-bom</artifactId>
+                <version>${dubbo.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.dubbo</groupId>
+                <artifactId>dubbo-registry-nacos</artifactId>
+                <version>${dubbo-nacos.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-web</artifactId>
+                <version>${spring-boot.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>ch.qos.logback</groupId>
+                        <artifactId>logback-classic</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.apache.logging.log4j</groupId>
+                        <artifactId>log4j-to-slf4j</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+        </dependencies>
+
+    </dependencyManagement>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-maven-plugin</artifactId>
+                    <version>${spring-boot.version}</version>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>repackage</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
+</project>
diff --git 
a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml 
b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml
new file mode 100644
index 000000000..310af2a3d
--- /dev/null
+++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml
@@ -0,0 +1,50 @@
+<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";>
+    <!--
+      ~
+      ~   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.
+      ~
+      -->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.dubbo</groupId>
+        <artifactId>dubbo-samples-gateway</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>dubbo-samples-gateway-apisix</artifactId>
+    <packaging>pom</packaging>
+    <name>Dubbo Samples Gateway Apisix</name>
+    <description>Dubbo Samples Gateway Apisix</description>
+    <modules>
+        <module>dubbo-samples-gateway-apisix-dubbo</module>
+    </modules>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/2-advanced/dubbo-samples-gateway/pom.xml 
b/2-advanced/dubbo-samples-gateway/pom.xml
index 620603c5c..0ac1c2401 100644
--- a/2-advanced/dubbo-samples-gateway/pom.xml
+++ b/2-advanced/dubbo-samples-gateway/pom.xml
@@ -31,6 +31,7 @@
     <description>Dubbo Samples Gateway</description>
 
     <modules>
+        <module>dubbo-samples-gateway-apisix</module>
         <module>dubbo-samples-gateway-higress</module>
     </modules>
 
diff --git a/2-advanced/pom.xml b/2-advanced/pom.xml
index 0439c77df..1da1ddb60 100644
--- a/2-advanced/pom.xml
+++ b/2-advanced/pom.xml
@@ -67,6 +67,7 @@
         <module>dubbo-samples-api-with-registry</module>
         <module>dubbo-samples-dubbo</module>
         <module>dubbo-samples-triple-rest</module>
+        <module>dubbo-samples-gateway</module>
         <module>dubbo-samples-multiple-protocols</module>
     </modules>
 </project>


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


Reply via email to