eventbus

package
v0.0.2-replace Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufSize

func BufSize(n int) func(interface{}) error

func Name

func Name(name string) func(interface{}) error

func NewBus

func NewBus(opts ...Option) event.Bus

func Stateful

func Stateful(s interface{}) error

Stateful is an Emitter option which makes the eventbus channel 'remember' last event sent, and when a new subscriber joins the bus, the remembered event is immediately sent to the subscription channel.

This allows to provide state tracking for dynamic systems, and/or allows new subscribers to verify that there are Emitters on the channel

Types

type MetricsTracer

type MetricsTracer interface {

	// EventEmitted counts the total number of events grouped by event type
	EventEmitted(typ reflect.Type)

	// AddSubscriber adds a subscriber for the event type
	AddSubscriber(typ reflect.Type)

	// RemoveSubscriber removes a subscriber for the event type
	RemoveSubscriber(typ reflect.Type)

	// SubscriberQueueLength is the length of the subscribers channel
	SubscriberQueueLength(name string, n int)

	// SubscriberQueueFull tracks whether a subscribers channel if full
	SubscriberQueueFull(name string, isFull bool)

	// SubscriberEventQueued counts the total number of events grouped by subscriber
	SubscriberEventQueued(name string)
}

MetricsTracer tracks metrics for the eventbus subsystem

func NewMetricsTracer

func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer

type MetricsTracerOption

type MetricsTracerOption func(*metricsTracerSetting)

type Option

type Option func(*basicBus)

func WithMetricsTracer

func WithMetricsTracer(metricsTracer MetricsTracer) Option

Jump to

Keyboard shortcuts

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