bus

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 4 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus interface {
	// Publish an event to the bus
	Publish(Event)

	// Subscribe to all events, filter them to the ones containing *all* the keys in filter
	Subscribe(filter ...string) Listener
}

Bus provides a common channel to emit and listen for Events

func New

func New(log *logp.Logger, name string) Bus

New initializes a new bus with the given name and returns it

func NewBusWithStore

func NewBusWithStore(log *logp.Logger, name string, size int) Bus

NewBusWithStore allows to create a buffered bus when producers send data without listeners being subscribed to them. size determines the size of the buffer.

type Event

type Event mapstr.M

Event sent to the bus

type KeystoreProvider

type KeystoreProvider interface {
	GetKeystore(event Event) keystore.Keystore
}

Provider for keystore

type Listener

type Listener interface {
	// Events channel
	Events() <-chan Event

	// Stop listening and removes itself from the bus
	Stop()
}

Listener retrieves Events from a Bus subscription until Stop is called

Jump to

Keyboard shortcuts

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