fix: initialize broker and subscribers
This commit is contained in:
parent
921f832670
commit
7968395d51
1
http.go
1
http.go
@ -238,6 +238,7 @@ func newServer(opts ...server.Option) server.Server {
|
||||
return &httpServer{
|
||||
opts: newOptions(opts...),
|
||||
exit: make(chan chan error),
|
||||
subscribers: make(map[*httpSubscriber][]broker.Subscriber),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package http
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/go-micro/broker"
|
||||
"github.com/micro/go-micro/codec"
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/server"
|
||||
@ -19,6 +20,10 @@ func newOptions(opt ...server.Option) server.Options {
|
||||
o(&opts)
|
||||
}
|
||||
|
||||
if opts.Broker == nil {
|
||||
opts.Broker = broker.DefaultBroker
|
||||
}
|
||||
|
||||
if opts.Registry == nil {
|
||||
opts.Registry = registry.DefaultRegistry
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user