event

package
v0.0.0-...-82ffc00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const EVENT_TOPIC_SERVER_QUIT = "SERVER_QUIT"

EVENT_TOPIC_SERVER_QUIT 服务退出事件

View Source
const EVENT_TOPIC_SERVICE_CHANGE = "SERVICE_CHANGE"

EVENT_TOPIC_SERVICE_CHANGE 服务实例变化事件

Variables

View Source
var GlobalEventBus = &EventBus{subscribers: map[string]DataChannelSlice{}}

Functions

This section is empty.

Types

type DataChannel

type DataChannel chan DataEvent

type DataChannelSlice

type DataChannelSlice []DataChannel

type DataEvent

type DataEvent struct {
	Data  interface{}
	Topic string
}

type EventBus

type EventBus struct {
	// contains filtered or unexported fields
}

EventBus 存储有关订阅者感兴趣的特定主题的信息

func (*EventBus) Publish

func (eb *EventBus) Publish(topic string, data interface{})

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(topic string, handler Handler)

type Handler

type Handler func(data interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL