You can quickly set the registry for debugging by calling the config.NewRegistryConfigWithProtocolDefaultPort method, and support zookeeper(127.0.0.1:2181) and nacos(127.0.0.1:8848)
rc := config. NewRootConfigBuilder().
SetConsumer(config. NewConsumerConfigBuilder().
SetRegistryIDs("zookeeperID"). // use defined registryID
Build()).
AddRegistry("zookeeperID", config. NewRegistryConfigWithProtocolDefaultPort("zookeeper")).
build()
All interfaces: can be configured by calling the rich interfaces provided by RegistryConfigBuilder.
rc := config. NewRootConfigBuilder().
SetConsumer(config. NewConsumerConfigBuilder().
SetRegistryIDs("nacosRegistryID"). // use defined registryID
AddReference("GreeterClientImpl", /*...*/).
build()
AddRegistry("nacosRegistryID", config. NewRegistryConfigBuilder().
SetProtocol("nacos").
SetAddress("127.0.0.1:8848").
SetGroup("dubbo-go").
SetNamespace("dubbo").
SetUsername("admin").
SetPassword("admin").
SetTimeout("3s").
Build()).
build()
Simple interface config.NewRegistryConfigWithProtocolDefaultPort
rc := config. NewRootConfigBuilder().
SetProvider(config. NewProviderConfigBuilder().
AddService("GreeterProvider", /*...*/).
SetRegistryIDs("registryKey"). // use defined registryIDs
Build()).
AddRegistry("registryKey", config. NewRegistryConfigWithProtocolDefaultPort("zookeeper")).
build()
All interfaces: can be configured by calling the rich interfaces provided by RegistryConfigBuilder.
rc := config. NewRootConfigBuilder().
SetProvider(config. NewProviderConfigBuilder().
AddService("GreeterProvider", /*...*/)
SetRegistryIDs("registryKey"). // use defined registryIDs
Build()).
AddRegistry("registryKey", config. NewRegistryConfigBuilder().
SetProtocol("nacos").
SetAddress("127.0.0.1:8848").
SetGroup("dubbo-go").
SetNamespace("dubbo").
SetUsername("admin").
SetPassword("admin").
SetTimeout("3s").
Build()).
build()
rc := config. NewRootConfigBuilder().
SetConsumer(config. NewConsumerConfigBuilder().
AddReference("GreeterClientImpl", config. NewReferenceConfigBuilder().
SetInterface("org. apache. dubbo. UserProvider").
SetProtocol("tri"). // set reference protocol to triple
Build()).
Build()).
build()
rc := config. NewRootConfigBuilder().
SetProvider(config. NewProviderConfigBuilder().
AddService("GreeterProvider", config. NewServiceConfigBuilder().
SetInterface("org. apache. dubbo. UserProvider").
SetProtocolIDs("tripleProtocolKey"). // use protocolID 'tripleProtocolKey'
Build()).
Build()).
AddProtocol("tripleProtocolKey", config. NewProtocolConfigBuilder(). // define protocol config with protocolID 'tripleProtocolKey'
SetName("tri"). // set service protocol to triple
Build()).
build()