eventbus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus[T any] struct {
	// contains filtered or unexported fields
}

This is mostly stateless EventBus with one modification: Any new subscriber will get the last published event for a topic immediately after subscribing.

TODO: Can this cache be improved(ttl or something) or is it too simple to concern myself with?

func NewEventBus

func NewEventBus[T any](parentLogger *logger.Logger) *EventBus[T]

func (*EventBus[T]) Publish

func (eb *EventBus[T]) Publish(topic string, data T)

func (*EventBus[T]) Subscribe

func (eb *EventBus[T]) Subscribe(topic string) <-chan T

func (*EventBus[T]) Unsubscribe

func (eb *EventBus[T]) Unsubscribe(topic string, ch <-chan T)

Jump to

Keyboard shortcuts

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