eventbus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProvider added in v0.2.0

func RegisterProvider(name string, provider BusProvider)

Types

type BusProvider added in v0.2.0

type BusProvider func(url string) (EventBus, error)

func GetProvider added in v0.2.0

func GetProvider(name string) (BusProvider, bool)

type ContextTiedBus added in v0.2.0

type ContextTiedBus interface {
	EventBus
	SetContext(ctx context.Context)
}

type Event

type Event = mdk.Event

Re-export/alias mdk event types

type EventBus

type EventBus interface {
	mdk.EventBus
	Close() error
}

type EventHandler

type EventHandler = mdk.EventHandler

type InMemBus

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

InMemBus is a thread-safe in-memory implementation of EventBus.

func NewInMemBus

func NewInMemBus() *InMemBus

NewInMemBus creates a new InMemBus.

func (*InMemBus) Close

func (b *InMemBus) Close() error

Close closes the event bus.

func (*InMemBus) Publish

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

Publish sends an event to all registered handlers for the event type.

func (*InMemBus) SetAsync

func (b *InMemBus) SetAsync(async bool)

SetAsync enables or disables asynchronous handler execution.

func (*InMemBus) Subscribe

func (b *InMemBus) Subscribe(namespace, eventType string, handler EventHandler) (func(), error)

Subscribe registers a handler for a specific event type.

Jump to

Keyboard shortcuts

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