eventbus

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("event bus closed")

Functions

This section is empty.

Types

type Event

type Event struct {
	Topic     string
	Payload   []byte
	Timestamp int64
}

func NewEvent

func NewEvent(topic string, payload []byte) Event

type EventHandler

type EventHandler func(ctx context.Context, event Event) error

type MemoryBus

type MemoryBus struct {
	// contains filtered or unexported fields
}

func NewMemoryBus

func NewMemoryBus() *MemoryBus

func (*MemoryBus) Close

func (b *MemoryBus) Close() error

func (*MemoryBus) Publish

func (b *MemoryBus) Publish(ctx context.Context, event Event) error

func (*MemoryBus) Subscribe

func (b *MemoryBus) Subscribe(topic string, handler EventHandler) (Subscription, error)

func (*MemoryBus) SubscribePattern

func (b *MemoryBus) SubscribePattern(pattern string, handler EventHandler) (Subscription, error)

type Subscription

type Subscription interface {
	Unsubscribe() error
}

Jump to

Keyboard shortcuts

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