Skip to main content

http-dubbo

Translates HTTP requests into Dubbo calls.

Category Other protocolsAdd it to Route, Service, Consumer, Consumer group, Global rule, Plugin configEngine plugin http-dubboPriority 504

What it does​

http-dubbo turns an HTTP request into a call to one method of a Dubbo service, the one under Service name and Method. The nodes of the route's upstream are the Dubbo providers, dialled over a raw socket and never asked as HTTP servers.

The body carries the parameters. With Serialized off it is read as JSON and sent one value per parameter, and with it on it is sent to the provider as it is.

When to use it​

  • The orders backend is a Java Dubbo service, com.example.orders.OrderService, and the mobile app reads an order over HTTP with getOrder.
  • Partners call the orders API over HTTPS, while the team keeps its providers on Dubbo inside the network.
  • A team opens one method of an internal Dubbo service to a web app, without writing an HTTP layer for it.

Not for a backend that speaks gRPC — see grpc-transcode (Translates HTTP and JSON requests into gRPC calls and back) or changing the path, Host or headers an HTTP backend receives — see proxy-rewrite (Rewrites the request URI, method, host and headers before proxying).

Set it up​

Call a Dubbo service method from an HTTP request​

Under Basics set Method to getOrder, set Service name to com.example.orders.OrderService and set Service version to 1.0.0. Under Behavior set Params type desc to Ljava/lang/String;.

http-dubbo · as the console saves it
{
"service_name": "com.example.orders.OrderService",
"service_version": "1.0.0",
"method": "getOrder",
"params_type_desc": "Ljava/lang/String;"
}

Things to know​

  • Service name — The route's own upstream nodes are dialled as the Dubbo provider over a raw socket, and are never asked as an HTTP server.
  • Service name — A configuration without a Service name is refused when you save.
  • Service version — A version starts with three numbers separated by dots. One with two numbers only, without its patch number, is refused when you save.
  • Params type desc — The types are positional, and only a body that is a JSON array keeps the order it is written in.
  • Serialization header key — With a header name set the switch above is never read: a request whose header does not say exactly true is handled as if the switch were off.
  • AdviceSend JSON arrays to a method with more than one parameter, so each value meets the type written for its place.

Settings​

The fields as the console shows them, section by section.

Basics​

MethodmethodstringRequired
at least 1 character
Service nameservice_namestringRequired
at least 1 character
Service versionservice_versionstringdefault 0.0.0
pattern^\d+\.\d+\.\d+

Behavior​

Params type descparams_type_descstringdefault

The parameter types of the call in order, sent to the provider exactly as written. It is positional, and only a JSON array body keeps the order it is written in.

Serializedserializedbooleandefault false

On, the body is sent to the provider as it is, and off it is read as JSON and sent one value per parameter.

Serialization header keyserialization_header_keystring
Connect timeoutconnect_timeoutnumberdefault 6000
in milliseconds
Read timeoutread_timeoutnumberdefault 6000
in milliseconds
Send timeoutsend_timeoutnumberdefault 6000
in milliseconds

Advanced​

Request body limitmax_req_body_sizeintegerdefault 67108864

The largest request body in bytes that is forwarded, where a larger one is rejected with 413.

at least 1

Every plugin also has Enabled, Priority, Filter, Error response and Pre-function: see Plugin execution settings.

G8 dev · Apache APISIX® 3.19.0
Apache, Apache APISIX and APISIX are trademarks of The Apache Software Foundation.
Facts
Category
Other protocols
Add it to
Route, Service, Consumer, Consumer group, Global rule, Plugin config
Engine plugin
http-dubbo
Priority
504