Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unsubscribe ¶
Unsubscribe - removes the subscriber, indicated by id, from the notifier, indicated by name
Types ¶
type Notifier ¶
type Notifier interface {
GetName() string
Stop()
Subscribe(Subscriber)
Unsubscribe(string) error
Start()
}
Notifier - any channel that has the potential to have listeners (1-n)
func RegisterNotifier ¶
RegisterNotifier - accepts a name and source channel to make a new notifier object
type PubSub ¶
type PubSub interface {
Publish(key, secondarykey string, data interface{}) error
PublishToTopic(data interface{}) error
PublishToTopicWithSecondaryKey(secondarykey string, data interface{}) error
PublishCacheHash(key, secondarykey string, data interface{}) error
PublishCacheHashToTopic(data interface{}) error
PublishCacheHashToTopicWithSecondaryKey(secondarykey string, data interface{}) error
Subscribe() (msgChan chan interface{}, id string)
SubscribeWithCallback(callback func(data interface{})) (id string)
Unsubscribe(id string) error
}
PubSub - interface for creating a PubSub library
type Subscriber ¶
type Subscriber interface {
GetID() string
SendMsg(interface{})
Close() // Unsubscribes and closes channel
// contains filtered or unexported methods
}
Subscriber - subscribes to a notifier
func Subscribe ¶
func Subscribe(name string, output chan interface{}) (Subscriber, error)
Subscribe - subscribes to events on the notifier sending them to the output channel.
Click to show internal directories.
Click to hide internal directories.