Restructure go-micro layout and plugins

This commit is contained in:
Asim
2015-05-23 20:04:16 +01:00
parent 018183fa49
commit 74fd1fc989
39 changed files with 673 additions and 577 deletions

View File

@@ -27,7 +27,7 @@ type Subscriber interface {
type options struct{}
type Options func(*options)
type Option func(*options)
var (
Address string
@@ -35,13 +35,17 @@ var (
DefaultBroker Broker
)
func NewBroker(addrs []string, opt ...Option) Broker {
return newHttpBroker([]string{Address}, opt...)
}
func Init() error {
if len(Id) == 0 {
Id = "broker-" + uuid.NewUUID().String()
}
if DefaultBroker == nil {
DefaultBroker = NewHttpBroker([]string{Address})
DefaultBroker = newHttpBroker([]string{Address})
}
return DefaultBroker.Init()