diff --git a/broker/broker.go b/broker/broker.go index 39db9f17..31013784 100644 --- a/broker/broker.go +++ b/broker/broker.go @@ -3,11 +3,10 @@ package broker // Broker is an interface used for asynchronous messaging. type Broker interface { + Init(...Option) error Options() Options - Address() string Connect() error Disconnect() error - Init(...Option) error Publish(string, *Message, ...PublishOption) error Subscribe(string, Handler, ...SubscribeOption) (Subscriber, error) String() string diff --git a/broker/http_broker.go b/broker/http_broker.go index 9f3f1012..01e39495 100644 --- a/broker/http_broker.go +++ b/broker/http_broker.go @@ -403,6 +403,7 @@ func (h *httpBroker) Connect() error { go func() { h.run(l) h.Lock() + h.opts.Addrs = []string{addr} h.address = addr h.Unlock() }() diff --git a/server/grpc/grpc.go b/server/grpc/grpc.go index 6575d3b6..75b8823f 100644 --- a/server/grpc/grpc.go +++ b/server/grpc/grpc.go @@ -714,7 +714,10 @@ func (g *grpcServer) Start() error { return err } - log.Logf("Broker [%s] Listening on %s", config.Broker.String(), config.Broker.Address()) + baddr := strings.Join(config.Broker.Options().Addrs, ",") + bname := config.Broker.String() + + log.Logf("Broker [%s] Listening on %s", bname, baddr) // announce self to the world if err := g.Register(); err != nil { diff --git a/server/rpc_server.go b/server/rpc_server.go index aec4cae7..524691fd 100644 --- a/server/rpc_server.go +++ b/server/rpc_server.go @@ -500,7 +500,10 @@ func (s *rpcServer) Start() error { return err } - log.Logf("Broker [%s] Connected to %s", config.Broker.String(), config.Broker.Address()) + baddr := strings.Join(config.Broker.Options().Addrs, ",") + bname := config.Broker.String() + + log.Logf("Broker [%s] Connected to %s", bname, baddr) // use RegisterCheck func before register if err = s.opts.RegisterCheck(s.opts.Context); err != nil {