Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SubscribeWithData ¶ added in v0.5.2
func SubscribeWithData(p Subscribable, topic Topic, notifee Notifee)
SubscribeWithData subscribes to the given subscriber on the given topic, and adds the notifies custom data into the list of data injected into callbacks when events occur on that topic
Types ¶
type EventTransform ¶
EventTransform if a fucntion transforms one kind of event to another
type Notifee ¶
type Notifee struct { Data TopicData Subscriber *TopicDataSubscriber }
Notifee is a topic data subscriber plus a set of data you want to add to any topics subscribed to (used to call SubscribeWithData to inject data when events for a given topic emit)
type Publisher ¶
type Publisher interface { Close(Topic) Publish(Topic, Event) Shutdown() Startup() Subscribable }
Publisher is an publisher of events that can be subscribed to
func NewPublisher ¶
func NewPublisher() Publisher
NewPublisher returns a new message event publisher
type Subscribable ¶
type Subscribable interface { Subscribe(topic Topic, sub Subscriber) bool Unsubscribe(sub Subscriber) bool }
Subscribable is a stream that can be subscribed to
type Subscriber ¶
Subscriber is a subscriber that can receive events
type TopicData ¶ added in v0.5.2
type TopicData interface{}
TopicData is data added to every message broadcast on a topic
type TopicDataSubscriber ¶ added in v0.5.2
type TopicDataSubscriber struct { Subscriber // contains filtered or unexported fields }
func NewTopicDataSubscriber ¶ added in v0.5.2
func NewTopicDataSubscriber(sub Subscriber) *TopicDataSubscriber
NewTopicDataSubscriber produces a subscriber that will transform events and topics before passing them on to the given subscriber
func (*TopicDataSubscriber) AddTopicData ¶ added in v0.5.2
func (m *TopicDataSubscriber) AddTopicData(id Topic, data TopicData)
func (*TopicDataSubscriber) OnClose ¶ added in v0.5.2
func (m *TopicDataSubscriber) OnClose(topic Topic)
func (*TopicDataSubscriber) OnNext ¶ added in v0.5.2
func (m *TopicDataSubscriber) OnNext(topic Topic, ev Event)