This article is more than one year old. Older articles may contain outdated content. Check that the information in the page has not become incorrect since its publication.
For a description of how to proxy triple protocol services with a gateway, please refer to the section on HTTP Gateway Access.
This article demonstrates how to use the combination of Apache APISIX + triple protocol + Nacos registry
to proxy Dubbo services.
The complete source code and deployment resource files for this example can be found at dubbo-samples-gateway-triple-apisix, with the architecture diagram as follows:
In this example, a triple service org.apache.dubbo.samples.gateway.apisix.DemoService
has been defined and published, with the interface defined as:
The interface implementation is as follows:
Dubbo service-related configuration:
Download and start Nacos locally.
Run the following command to start the Dubbo application.
Download the source code:
In the dubbo-samples-gateway-apisix-triple
directory, run the following command to start the application:
Run the following command to test if the service has started normally:
This document uses Docker to install APISIX. Ensure that Docker and Docker Compose are installed locally.
First, download the apisix-docker repository.
Since this example needs to connect to the Nacos registry, the docker-compose.yaml
in the apisix-docker/example
directory needs to be modified to add the following Docker Compose configuration:
Before starting APISIX, add the following configuration to the conf/config.yaml
file to connect APISIX to the Nacos registry:
Finally, enable APISIX using docker-compose
: docker-compose -p docker-apisix up -d
.
Configure Nacos upstream and routes in APISIX to achieve automatic discovery of backend instance addresses (assuming the APISIX port is 9080):
In the above command, the request header X-API-KEY is the access token for the Admin API, which can be found in the apisix.admin_key.key in the conf/config.yaml file.
Use the following command to send a request to the route that needs to be configured:
If you find the HTTP port /org.apache.dubbo.samples.gateway.apisix.DemoService/sayHello/
not friendly enough for gateway access, refer to Publishing REST Style HTTP Interfaces for Triple Protocol.