Documentation ¶
Index ¶
- func NewDefaultBusInformer(bus EventBus) (actuator.Informer, error)
- func Publish(event Event)
- func Register(subscribers ...Subscriber)
- func ReplaceGlobal(bus EventBus, publisher Publisher)
- func Run()
- type DebugLog
- type DefaultBusInformer
- type DefaultEventBus
- type DefaultPublisher
- type Event
- type EventBus
- type EventBusOpt
- type Executor
- type Publisher
- type PublisherOpt
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(subscribers ...Subscriber)
func ReplaceGlobal ¶
Types ¶
type DefaultBusInformer ¶
type DefaultBusInformer struct {
// contains filtered or unexported fields
}
func (DefaultBusInformer) Key ¶
func (d DefaultBusInformer) Key() string
func (DefaultBusInformer) Value ¶
func (d DefaultBusInformer) Value() interface{}
type DefaultEventBus ¶
type DefaultEventBus struct {
// contains filtered or unexported fields
}
func NewDefaultEventBus ¶
func NewDefaultEventBus(opts ...EventBusOpt) *DefaultEventBus
func (*DefaultEventBus) Deliver ¶
func (b *DefaultEventBus) Deliver(event Event)
func (*DefaultEventBus) Register ¶
func (b *DefaultEventBus) Register(subscribers ...Subscriber)
func (*DefaultEventBus) Run ¶
func (b *DefaultEventBus) Run()
func (*DefaultEventBus) Stop ¶
func (b *DefaultEventBus) Stop()
type DefaultPublisher ¶
type DefaultPublisher struct {
// contains filtered or unexported fields
}
func NewDefaultPublisher ¶
func NewDefaultPublisher(bus EventBus, opts ...PublisherOpt) *DefaultPublisher
func (*DefaultPublisher) Publish ¶
func (p *DefaultPublisher) Publish(event Event)
type Event ¶
type Event interface { // Identifier returns the ID of event Identifier() string // Name returns event name of current event Name() string // Context returns the current context of event Context() context.Context // Payload returns event payload of current event Payload() interface{} // String convert event data to string String() string }
type EventBus ¶
type EventBus interface { // Register subscriber(s) with the bus Register(subscribers ...Subscriber) // Deliver an event Deliver(event Event) // Run the bus Run() // Stop the bus Stop() }
func GetEventBus ¶
func GetEventBus() EventBus
type EventBusOpt ¶
type EventBusOpt func(bus *DefaultEventBus)
func WithEventBusDebugLog ¶
func WithEventBusDebugLog(debugLog DebugLog) EventBusOpt
func WithEventChannelSize ¶
func WithEventChannelSize(size int) EventBusOpt
func WithEventExecutor ¶
func WithEventExecutor(executor Executor) EventBusOpt
type Publisher ¶
type Publisher interface { // Publish an event Publish(event Event) }
func GetPublisher ¶
func GetPublisher() Publisher
type PublisherOpt ¶
type PublisherOpt func(pub *DefaultPublisher)
func WithPublisherDebugLog ¶
func WithPublisherDebugLog(debugLog DebugLog) PublisherOpt
func WithPublisherNotLogPayload ¶
func WithPublisherNotLogPayload(events []string) PublisherOpt
type Subscriber ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.