{"id":51021154,"url":"https://github.com/wxsimon2022/dubboconn","last_synced_at":"2026-06-21T16:32:34.688Z","repository":{"id":364664398,"uuid":"1268766790","full_name":"wxsimon2022/dubboconn","owner":"wxsimon2022","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-13T23:36:11.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-14T01:14:20.988Z","etag":null,"topics":["apache-dubbo","dubbo","dubbo-go","go","microservices","nacos","rpc","service-discovery"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wxsimon2022.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T23:07:43.000Z","updated_at":"2026-06-13T23:36:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wxsimon2022/dubboconn","commit_stats":null,"previous_names":["wxsimon2022/dubboconn"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wxsimon2022/dubboconn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxsimon2022%2Fdubboconn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxsimon2022%2Fdubboconn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxsimon2022%2Fdubboconn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxsimon2022%2Fdubboconn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wxsimon2022","download_url":"https://codeload.github.com/wxsimon2022/dubboconn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxsimon2022%2Fdubboconn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34618475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-dubbo","dubbo","dubbo-go","go","microservices","nacos","rpc","service-discovery"],"created_at":"2026-06-21T16:32:34.073Z","updated_at":"2026-06-21T16:32:34.675Z","avatar_url":"https://github.com/wxsimon2022.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dubboconn\n\n\u003e One-package solution for Nacos service discovery + Dubbo consumer connectivity in Go.\n\n`dubboconn` combines a full-featured Nacos client (service discovery, configuration\nmanagement) with dubbo-go consumer proxy creation. No separate Nacos wrapper packages\nneeded — everything lives in this module.\n\n## Features\n\n- **Nacos Client** — `NewNacos()` for standalone service discovery and config management\n- **Dubbo Connect** — `Connect()` discovers a provider via Nacos and creates a ready-to-use\n  dubbo-go consumer proxy in a single call\n- **Provider Change Notification** — `Connection.Watch()` subscribes to Nacos instance changes\n- **Config Management** — `GetConfig`, `ListenConfig`, `PublishConfig`, `DeleteConfig`\n- **No Extra Dependencies** — Nacos wrapper code is inlined; only `nacos-sdk-go` and `dubbo-go`\n\n## Installation\n\n```bash\ngo get github.com/wxsimon2022/dubboconn\n```\n\nIf your project vendors dependencies, run `go mod vendor` after the `go get`.\n\n## Quick Start\n\n### 1. Define your Dubbo service interface as a Go struct\n\n```go\nimport \"context\"\n\ntype Greeter struct {\n    SayHello   func(ctx context.Context, name string) (string, error)\n    SayGoodBye func(ctx context.Context, name string) (string, error)\n}\n```\n\nEach exported field must be a function type matching your Dubbo Java interface method\nsignature. dubbo-go uses reflection to wire these fields to RPC proxies.\n\n### 2. Connect — discover \u0026 create proxy in one call\n\n```go\nimport \"github.com/wxsimon2022/dubboconn\"\n\nvar svc Greeter\n\nconn, err := dubboconn.Connect(dubboconn.Config{\n    // Nacos server\n    NacosHost:      \"127.0.0.1\",\n    NacosPort:      8848,\n    NacosNamespace: \"public\",\n    NacosUsername:  \"nacos\",\n    NacosPassword:  \"nacos\",\n\n    // Dubbo service to discover\n    ServiceName:   \"providers:org.apache.dubbo.demo.Greeter::\",\n    InterfaceName: \"org.apache.dubbo.demo.Greeter\",\n}, \u0026svc)\nif err != nil {\n    log.Fatalf(\"connect: %v\", err)\n}\n```\n\n### 3. Call methods\n\n```go\nresp, err := svc.SayHello(context.Background(), \"world\")\nif err != nil {\n    log.Printf(\"RPC failed: %v\", err)\n}\nfmt.Println(resp) // \"hello, world\" (from Java Dubbo server)\n```\n\n### 4. (Optional) Watch for provider changes\n\n```go\nconn.Watch(func(newURL string) {\n    log.Printf(\"Provider changed to: %s\", newURL)\n})\n```\n\n## Standalone Nacos Client\n\nIf you only need Nacos service discovery or config management (no Dubbo):\n\n```go\nclient, err := dubboconn.NewNacos(dubboconn.NacosConfig{\n    Host:      \"127.0.0.1\",\n    Port:      8848,\n    Namespace: \"public\",\n})\n\n// Service discovery\ninstances, _ := client.GetInstances(\"my-service\")\nfor _, inst := range instances {\n    fmt.Printf(\"  %s:%d (healthy=%v)\\n\", inst.Ip, inst.Port, inst.Healthy)\n}\n\n// Subscribe to changes\nclient.Watch(\"my-service\", func(instances []model.Instance) {\n    fmt.Printf(\"now %d instances\\n\", len(instances))\n})\n\n// Configuration\nval, _ := client.GetConfig(\"app.yml\", dubboconn.WithGroup(\"APP\"))\nclient.ListenConfig(\"app.yml\", func(v string) {\n    fmt.Println(\"config updated:\", v)\n})\n```\n\n## Config Reference\n\n### `NacosConfig` — for `NewNacos()`\n\n| Field | Default | Description |\n|-------|---------|-------------|\n| `Host` | — (required) | Nacos server address |\n| `Port` | `8848` | Nacos server port |\n| `Namespace` | `\"public\"` | Nacos namespace ID |\n| `Username` | — | Nacos auth username |\n| `Password` | — | Nacos auth password |\n| `AppName` | — | Application identifier |\n| `LogDir` | — | SDK log output directory |\n| `LogLevel` | `\"info\"` | SDK log verbosity |\n| `TimeoutMs` | `5000` | Request timeout (ms) |\n\n### `Config` — for `Connect()`\n\n| Field | Default | Description |\n|-------|---------|-------------|\n| `NacosHost` | — (required) | Nacos server address |\n| `NacosPort` | `8848` | Nacos server port |\n| `NacosNamespace` | `\"public\"` | Nacos namespace |\n| `NacosUsername` | — | Nacos auth username |\n| `NacosPassword` | — | Nacos auth password |\n| `ServiceName` | — (required) | Nacos service name to discover |\n| `InterfaceName` | — (required) | Dubbo interface fully-qualified name |\n| `Protocol` | `\"tri\"` | RPC protocol (Triple) |\n| `Retries` | `\"2\"` | RPC retry count |\n| `RequestTimeout` | `\"30s\"` | RPC timeout |\n| `Serialization` | `\"hessian2\"` | Serialization format |\n| `ProbeTimeout` | `0` (skip) | Connection probe timeout |\n| `NacosAppName` | `InterfaceName` | Application identifier sent to Nacos |\n\n## Error Handling\n\nThe package returns standard Go errors that can be checked with `errors.Is`:\n\n```go\nimport \"errors\"\n\n_, err := dubboconn.Connect(...)\nif errors.Is(err, dubboconn.ErrNoInstances) {\n    log.Println(\"no provider available — is the Java service running?\")\n}\n```\n\nSentinel errors:\n- `ErrNamingNotInit` — Nacos naming client is nil\n- `ErrConfigNotInit` — Nacos config client is nil (skipped during init)\n- `ErrNoInstances` — No available instances found for the service\n- `ErrNotConnected` — Operation attempted before connection\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────┐\n│                   dubboconn                          │\n│                                                      │\n│  NewNacos(NacosConfig) → *Client                     │\n│    ├─ GetInstances / Watch      (service discovery)  │\n│    ├─ Register / Deregister     (service registry)   │\n│    └─ GetConfig / ListenConfig  (config management)  │\n│                                                      │\n│  Connect(Config, \u0026svc) → *Connection                 │\n│    ├─ 1. NewNacos()         → init Nacos client      │\n│    ├─ 2. GetInstances()     → discover provider      │\n│    ├─ 3. ReferenceConfig    → create dubbo proxy     │\n│    └─ 4. ref.Refer/Implement → wire function fields  │\n│         ↓                                            │\n│    svc.SayHello(ctx, \"world\") → works immediately    │\n└─────────────────────────────────────────────────────┘\n```\n\n## Requirements\n\n- Go 1.23+\n- A running Nacos server with registered Dubbo (Triple) providers\n- dubbo-go v3 (imported transitively through this package)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwxsimon2022%2Fdubboconn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwxsimon2022%2Fdubboconn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwxsimon2022%2Fdubboconn/lists"}