Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Subscribe ¶
func Subscribe(topic string, fn SubscribeFunc)
Types ¶
type GoEvent ¶ added in v1.1.8
type GoEvent struct { DefaultTopic string // contains filtered or unexported fields }
支持同步和异步执行(发送和接收)
默认是同步执行
func (*GoEvent) Publish ¶ added in v1.1.8
发布 执行当前topic 对应的所有订阅者, async=true 则异步执行(并发执行无序),否则同步执行保证channel发送顺序
func (*GoEvent) Subscribe ¶ added in v1.1.8
func (ev *GoEvent) Subscribe(topic string, fn SubscribeFunc, async ...bool)
订阅:一个topic可以对应多个处理器,(topic->handler 的关系是1:n),一次添加一个订阅者
func (*GoEvent) UnSubscribe ¶ added in v1.1.8
取消订阅(topic 对应的所有订阅者)
func (*GoEvent) UnSubscribeDefault ¶ added in v1.2.34
func (ev *GoEvent) UnSubscribeDefault()
type MessageChan ¶
type MessageChan chan Message
type SubscribeFunc ¶
type SubscribeFunc func(msg Message)
Click to show internal directories.
Click to hide internal directories.