eventBus

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

README

责任链模式实现

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncEventBus

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

AsyncEventBus 异步事件总线

func NewEventBus

func NewEventBus() *AsyncEventBus

NewEventBus new

func (*AsyncEventBus) Publish

func (bus *AsyncEventBus) Publish(ctx context.Context, topic string, args ...interface{})

Publish 发布 这里异步执行,并且不会等待返回结果

func (*AsyncEventBus) Subscribe

func (bus *AsyncEventBus) Subscribe(topic string, f interface{}) error

Subscribe 订阅

type Bus

type Bus interface {
	Subscribe(topic string, handler interface{}) error
	Publish(ctx context.Context, topic string, args ...interface{})
}

Jump to

Keyboard shortcuts

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