Nacos Service Call
x/nacosServiceCall: discovers a healthy instance via nacos, calls the cluster microservice over HTTP, and writes the response to msg.Data. Routes to Success on success, Failure on error (including HTTP ≥ 400).
Requires extension library: rulego-components-discovery (opens new window)
# Configuration
Inherits Common Connection Config. Extra fields:
| Field | Type | Description | Default |
|---|---|---|---|
| serviceName | string | nacos-registered service name | none (required) |
| groupName | string | Service group | DEFAULT_GROUP |
| method | string | HTTP method (GET/POST/PUT/DELETE/PATCH) | GET |
| path | string | Request path, supports ${msg.xx} | empty |
| body | string | Request body, supports ${msg.xx}; empty uses msg.Data | empty |
# Behavior
- Instance selection: picks a healthy instance from nacos with round-robin load balancing.
- Request body: if
bodyis configured (with${}template or a literal) it is rendered; otherwise the current message content (msg.Data) is passed through as the body. - Response: backend response body is written to
msg.Data; HTTP status ≥ 400 triggersFailure.
# Examples
GET call to user-service registered in nacos:
{
"id": "call_user",
"type": "x/nacosServiceCall",
"configuration": {
"server": "127.0.0.1:8848",
"serviceName": "user-service",
"groupName": "DEFAULT_GROUP",
"method": "GET",
"path": "/info"
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
POST with a templated body:
{
"id": "create_order",
"type": "x/nacosServiceCall",
"configuration": {
"server": "127.0.0.1:8848",
"serviceName": "order-service",
"method": "POST",
"path": "/orders",
"body": "${msg.payload}"
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# Related
- Config read: x/nacosConfigGet
- Config write: x/nacosConfigSet
- Config listen: endpoint/nacos
Edit this page on GitHub (opens new window)
Last Updated: 2026/08/01, 05:05:14