Skip to main content

Version: 2.13.2304

Support Dubbo configuration

API7 implements the httpproxy to dubbothrough the dubbo-proxy plugin.

Enable dubbo-proxy plugin

Enable

API7 does not load the dobbo-proxy plugin by default. You need to add the following configuration to the configuration file of the gateway node ./conf/config.yaml. Restart the gateway node and activate the plugin.

# Add this in config.yaml
plugins:
- ... # plugin you need
- dubbo-proxy
plugin_attr:
dubbo-proxy:
upstream_multiplex_count: 32

Parameter description

NameTypeRequiredDefault ValueValid ValueDescription
upstream_multiplex_countnumberYes32>=1Maximum number of multiplex requests in an upstream connection

Binding API

The activation method of the dubbo-proxy plugin was introduced earlier. After the plugin is activated, it can bind the API to implement the http proxy to dubbo.

When binding the API, the dubbo-proxy plugin only needs to configure one field, as described below:

NameTypeRequiredDefault ValueDescription
service_namestringYesDubbo service name
service_versionstringYesDubbo service version
methodstringNoURI pathDubbo service method

Example

To facilitate verification, we need to first create an API and proxy requests to the Dubbo service under test.

The steps in the API7 Dashboard are as follows

  1. Create plugin templates
  2. Go to the API > Plugin Template page, click the Create button, and create a plugin template for dubbo-proxy.
  3. On the new plugin template page, enter the plugin template description, find the dubbo-proxy plugin through the search feature, and click the enable button

In the dubbo-proxy plugin configuration page, enable the plugin and configure it as follows:

{
"service_name": "org.apache.dubbo.sample.tengine.DemoService",
"service_version": "0.0.0",
"method": "tengineDubbo"
}

Click the submit button 3. Returning to the Create Plugin Template page, you can see that the enable button of skywalking has turned blue, indicating that it is already enabled, click the submit button to create a plugin template.

Now, we have created a plugin template that includes the dubbo-proxy plugin, which can be used for API creation.

  1. Create upstream upstream1, and the node IP port is 127.0.0.1:20880. The process of creating upstream is detailed in the Upstream - > Create Upstream chapter. 127.0.0.1:20880 the server address and open port where the Dubbo service is deployed

  2. Create an API and configure the upstream service to upstream1, path, dubbo-proxy plugin, etc. For the process of creating an API, please refer to the API Management - > Create API section, here postscript if the dubbo-proxy plugin is enabled on the API. In the process of creating the API, the plugin template can be selected from the dubbo-proxy template we have created.

  3. Test request

The data returned from the upstream dubbo service must be of type Map < String, String > . The sample service should return the following data

{    
"status": "200",
"header1": "value1",
"header2": "valu2",
"body": "blahblah"
}

Then the API request is as follows:

$ curl http://gateway_ip:port/hello

HTTP/1.1 200 OK # "status" will be the status code
...
header1: value1
header2: value2
...
blahblah # "body" will be the body

Disable the dubbo-proxy plugin

Remove dubbo-proxy plugin for API binding

Stop specifying the API proxy Dubbo service, visually configure the API data through the API7 Dashboard, and submit it after the relevant configuration of the dubbo-proxy plugin is removed.

Here, modify the API directly through the API7 Dashboard, remove the bound dubbo-proxy plugin, and click the submit button.

Plugin disabled

Disable the dubbo-proxy plugin globally. To destroy the Timer, you need to restore ./conf/config.yaml or comment the dubbo-proxy below the plugins section. It will take effect after overloading API7:

plugins:
# - dubbo-proxy "#" means disable this plugin

API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN Ltd. 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation