many many things
This commit is contained in:
1 parent
fb9084794c
commit
af69e728a2
9 files changed
+253
-59
No files matched your search
+9
-3
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/didiercrunch/doorman/nanomsgsubscriber"
|
||||
"github.com/didiercrunch/doorman/nsqsubscriber"
|
||||
"github.com/didiercrunch/doorman/shared"
|
||||
"github.com/didiercrunch/doorman/subscriber"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
)
|
||||
|
||||
@@ -11,16 +12,21 @@ type Subscriber interface {
|
||||
Subscribe(doormanId bson.ObjectId, update shared.UpdateHandlerFunc) error
|
||||
}
|
||||
|
||||
func (w *Doorman) Subscribe(sub Subscriber) error {
|
||||
func (w *Doorman) subscribe(sub Subscriber) error {
|
||||
return sub.Subscribe(w.Id, w.Update)
|
||||
}
|
||||
|
||||
func (w *Doorman) NSQSubscriber(NSQLookupdURl string) error {
|
||||
sub := &nsqsubscriber.NSQSubscriber{NSQLookupdURl}
|
||||
return w.Subscribe(sub)
|
||||
return w.subscribe(sub)
|
||||
}
|
||||
|
||||
func (w *Doorman) NanoMsgSubscriber(NanoMsgUrlLookupdURl string) error {
|
||||
sub := &nanomsgsubscriber.NanoMsgSubscriber{NanoMsgUrlLookupdURl}
|
||||
return w.Subscribe(sub)
|
||||
return w.subscribe(sub)
|
||||
}
|
||||
|
||||
func (w *Doorman) Subscriber(serverUrl string) error {
|
||||
sub := &subscriber.Subscriber{serverUrl}
|
||||
return w.subscribe(sub)
|
||||
}
|
||||
Reference in new issue
Block a user