Documentation
¶
Index ¶
- func Close() error
- func Publish(ctx context.Context, topic string, message any) error
- func SetEventbus(eb Eventbus)
- func Subscribe(ctx context.Context, topic string, handler EventHandler) error
- func Unsubscribe(ctx context.Context, topic string, handler EventHandler) error
- type Event
- type EventHandler
- type Eventbus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Subscribe ¶
func Subscribe(ctx context.Context, topic string, handler EventHandler) error
Subscribe 订阅事件
func Unsubscribe ¶
func Unsubscribe(ctx context.Context, topic string, handler EventHandler) error
Unsubscribe 取消订阅
Types ¶
type EventHandler ¶
type EventHandler = internal.EventHandler
type Eventbus ¶
type Eventbus interface {
// Close 关闭事件总线
Close() error
// Publish 发布事件
Publish(ctx context.Context, topic string, message any) error
// Subscribe 订阅事件
Subscribe(ctx context.Context, topic string, handler EventHandler) error
// Unsubscribe 取消订阅
Unsubscribe(ctx context.Context, topic string, handler EventHandler) error
}
Click to show internal directories.
Click to hide internal directories.