http-dubbo
Translates HTTP requests into Dubbo calls.
http-dubboPriority 504What 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 withgetOrder. - 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;.
{
"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
methodstringRequiredservice_namestringRequiredservice_versionstringdefault 0.0.0pattern
^\d+\.\d+\.\d+Behavior
params_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.
serializedbooleandefault falseOn, 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_keystringconnect_timeoutnumberdefault 6000read_timeoutnumberdefault 6000send_timeoutnumberdefault 6000Advanced
max_req_body_sizeintegerdefault 67108864The largest request body in bytes that is forwarded, where a larger one is rejected with 413.