Oxidaner opened a new pull request, #3711:
URL: https://github.com/apache/dubbo-go/pull/3711

   
   ### Description
   
   Fixes #3499
   
   Dubbo Admin discovers callable services by reading interface-level service 
definitions from the metadata center. Java providers publish these via 
`MetadataUtils.publishServiceDefinition`; dubbo-go had no equivalent, so Go 
services were invisible to Admin even when fully registered.
   
   This adds the publish path. A new `metadata/definition` package builds a 
contract from the reflection data already held in `common.ServiceMap` and emits 
JSON wire-compatible with Java's `FullServiceDefinition`.
   
   **Publishing is a capability, not a new `MetadataReport` method.** 
`report.ServiceDefinitionPublisher` is an optional interface queried through 
`DelegateMetadataReport.ServiceDefinitionPublisher`. Adding a method to 
`MetadataReport` would break every third-party report at compile time for a 
feature only some backends can serve. Nacos implements it; zookeeper, etcd and 
external reports are unaffected.
   
   **The contract speaks Java's type vocabulary.** Not a concession to any 
consumer — it is the vocabulary this runtime already uses. `filter/generic` 
matches caller-supplied `$invoke` type names against 
`protocol/dubbo/hessian2.GetJavaName` output when deciding whether to unwrap a 
packed variadic tail; names that helper does not recognize silently leave the 
tail packed. A pointer selects the boxed form, so Go's `T` vs `*T` carries 
nullability the way Java's primitive vs wrapper does. Maps carry both type 
arguments as `items` (one item means collection, two means map). 
`uint`/`uint64` are refused — their range runs past every Java integer type.
   
   **Nothing ever deletes a definition,** so the daily cycle report 
re-publishes what the process still exports. That is what makes "last updated 
long ago and no live instance" a safe death test; without it, never-deleting is 
an unbounded leak with no way to tell the garbage apart. Java relies on the 
same property via `AbstractMetadataReport`'s daily `publishAll`.
   
   **Failures do not block registration.** A provider whose definition did not 
land still serves traffic; it is only missing from Admin's console. Failures 
retry with bounded backoff, and the daily pass is the backstop. Java reaches 
the same outcome by publishing asynchronously.
   
   Publishing is switchable via `metadata-report.report-definition`, defaulting 
to on, mirroring Java's `report-definition`.
   
   Out of scope: Triple IDL and streaming (a protobuf contract must come from 
the descriptor, not the lossy generated struct); definition cleanup on provider 
shutdown (Java does not do it either); zookeeper/etcd publishers.
   
   ### Checklist
   - [x] I confirm the target branch is `develop`
   - [x] I have run `make fmt` to format my code
   - [x] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to