chickenlj commented on code in PR #2445:
URL: https://github.com/apache/dubbo-go/pull/2445#discussion_r1355972184
##########
protocol/triple/internal/server/cmd_instance_with_registry/main.go:
##########
@@ -31,11 +31,11 @@ func main() {
// configure global configurations and common modules
ins, err := dubbo.NewInstance(
dubbo.WithName("dubbo_test"),
- dubbo.WithRegistry("zk",
+ dubbo.WithRegistry(
registry.WithZookeeper(),
registry.WithAddress("127.0.0.1:2181"),
Review Comment:
Is 'registry.WithAddress("zookeeper://127.0.0.1:2181")' a valid method to
configure Registry, a combination of WithZookeeper() and
WithAddress("127.0.0.1:2181")? We should support this format if we want to give
a consistent experience to users.
##########
protocol/options.go:
##########
@@ -27,12 +28,30 @@ import (
type Options struct {
Protocol *global.ProtocolConfig
+
+ ID string
}
-func DefaultOptions() *Options {
+func defaultOptions() *Options {
return &Options{Protocol: global.DefaultProtocolConfig()}
}
+func NewOptions(opts ...Option) *Options {
+ defOpts := defaultOptions()
+ for _, opt := range opts {
+ opt(defOpts)
+ }
+
+ if defOpts.Protocol.Name == "" {
+ panic(fmt.Sprintf("Please specify registry, eg. WithTriple()"))
Review Comment:
Should we default to 'triple' protocol if the protocol name is not present?
So, this raises another question, what's the current default behavior if
users do not specify any information about the protocol at all?
``server.NewServer()`
--
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]