eventbus

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 10 Imported by: 106

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufSize

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

func Name added in v0.25.0

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 added in v0.25.0

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 added in v0.25.0

func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer

type MetricsTracerOption added in v0.25.0

type MetricsTracerOption func(*metricsTracerSetting)

func WithRegisterer added in v0.26.0

func WithRegisterer(reg prometheus.Registerer) MetricsTracerOption

type Option added in v0.25.0

type Option func(*basicBus)

func WithMetricsTracer added in v0.25.0

func WithMetricsTracer(metricsTracer MetricsTracer) Option

Jump to

Keyboard shortcuts

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