Service Discovery Overview
rulego-components-discovery provides nacos microservice integration: **service discovery & call**, **config read**, **config write**, and **config change listen**.
Requires extension library: rulego-components-discovery (opens new window)
# Positioning
Integrates into a microservice cluster as a "singleton member" — rulego stays single-instance, using nacos for service discovery and config read/listen/write, without introducing multi-replica leader-election issues. Multi-instance HA is a separate runtime topic, out of scope.
# Components
| Component | Description |
|---|---|
| x/nacosServiceCall | Discover healthy instances via nacos and call cluster microservices |
| x/nacosConfigGet | Read config content from nacos |
| x/nacosConfigSet | Write (publish) config to nacos |
| endpoint/nacos | Listen to nacos config changes, auto-trigger rule chain on change |
# Common Connection Config
All components share ConnConfig (anonymously embedded, JSON fields flattened into component configuration):
| Field | Type | Description | Default |
|---|---|---|---|
| server | string | nacos address list, comma-separated, e.g. 127.0.0.1:8848 | 127.0.0.1:8848 |
| namespace | string | Namespace ID | empty (public) |
| timeout | int | Request timeout (seconds) | 5 |
| auth | object | Auth: username/password for open auth, accessKey/secretKey for Alibaba Cloud | none |
| tls | object | TLS: certFile/certKeyFile/caFile/insecureSkipVerify | none |
Components with the same
serverautomatically reuse the nacos client connection (base.SharedNode); you can also explicitly reuse an on-canvas node's connection withref://ownerId.
# Import
import (
_ "github.com/rulego/rulego-components-discovery/external/nacos"
_ "github.com/rulego/rulego-components-discovery/endpoint/nacos"
)
1
2
3
4
2
3
4
No special build tags; blank import registers all components.
Edit this page on GitHub (opens new window)
Last Updated: 2026/08/01, 05:05:14