bus

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: AGPL-3.0 Imports: 7 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandler

func AddHandler(handler HandlerFunc)

func AddListener

func AddListener(handler HandlerFunc)

func Dispatch

func Dispatch(ctx context.Context, msgs ...Msg) error

func GetCallCount added in v0.20.0

func GetCallCount(msg Msg) int

GetCallCount returns the number of times a handler has been called Only available during unit tests

func MustDispatch

func MustDispatch(ctx context.Context, msgs ...Msg)

func Publish

func Publish(ctx context.Context, msgs ...Msg)

func Register

func Register(svc Service)

func Reset

func Reset()

Types

type HandlerFunc

type HandlerFunc any

type Msg

type Msg any

type Service

type Service interface {
	Name() string
	Category() string
	Enabled() bool
	Init()
}

func Init

func Init(forcedServices ...Service) []Service

Initializes the bus services that have been registered via bus.Register Services that set via Init(...services) are always registered (regardless of Enabled() function) / and have preference over services registered from bus.Register

Jump to

Keyboard shortcuts

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