Broker init
This commit is contained in:
@@ -106,7 +106,7 @@ var (
|
||||
},
|
||||
}
|
||||
|
||||
DefaultBrokers = map[string]func([]string, ...broker.Option) broker.Broker{
|
||||
DefaultBrokers = map[string]func(...broker.Option) broker.Broker{
|
||||
"http": broker.NewBroker,
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ func (c *cmd) Before(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
if b, ok := c.opts.Brokers[name]; ok {
|
||||
n := b(strings.Split(ctx.String("broker_address"), ","))
|
||||
n := b(broker.Addrs(strings.Split(ctx.String("broker_address"), ",")...))
|
||||
*c.opts.Broker = n
|
||||
} else {
|
||||
return fmt.Errorf("Broker %s not found", name)
|
||||
|
@@ -25,7 +25,7 @@ type Options struct {
|
||||
Client *client.Client
|
||||
Server *server.Server
|
||||
|
||||
Brokers map[string]func([]string, ...broker.Option) broker.Broker
|
||||
Brokers map[string]func(...broker.Option) broker.Broker
|
||||
Registries map[string]func([]string, ...registry.Option) registry.Registry
|
||||
Selectors map[string]func(...selector.Option) selector.Selector
|
||||
Transports map[string]func([]string, ...transport.Option) transport.Transport
|
||||
@@ -93,7 +93,7 @@ func Server(s *server.Server) Option {
|
||||
}
|
||||
|
||||
// New broker func
|
||||
func NewBroker(name string, b func([]string, ...broker.Option) broker.Broker) Option {
|
||||
func NewBroker(name string, b func(...broker.Option) broker.Broker) Option {
|
||||
return func(o *Options) {
|
||||
o.Brokers[name] = b
|
||||
}
|
||||
|
Reference in New Issue
Block a user