AlexStocks commented on code in PR #873: URL: https://github.com/apache/dubbo-go-samples/pull/873#discussion_r2472205688
########## config_center/apollo/README.md: ########## @@ -0,0 +1,76 @@ +# Dubbo-go Config-Center Sample + +## 1. Introduction + +This example shows dubbo-go's dynamic configuration feature with Apollo as config-center. + +## 2. How to run + +### Configure the configuration file into apollo + +```yaml +dubbo: + registries: + demoZK: + protocol: zookeeper + timeout: 3s + address: '127.0.0.1:2181' + protocols: + triple: + name: tri + port: 20000 + provider: + services: + GreeterProvider: + interface: com.apache.dubbo.sample.basic.IGreeter +``` + +Open `https://localhost:8070` with browser, make sure the relevant configuration is already in place in apollo. + +### Start an instance with apollo as the configuration center + +```go +ins, err := dubbo.NewInstance( + dubbo.WithConfigCenter( + config_center.WithApollo(), + config_center.WithAddress("127.0.0.1:8080"), + config_center.WithNamespace("dubbo.yml"), + config_center.WithDataID("dubbo.yml"), + config_center.WithAppID("SampleApp"), + config_center.WithCluster("default"), + config_center.WithFileExtProperties(), + ), +) +if err != nil { + panic(err) Review Comment: 上下文中用 panic 的地方,改成 log.Fatal -- 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]
