inmemory

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleInMemoryEventBus

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

SimpleInMemoryEventBus is a basic, in-process event bus implementation. Note: This implementation is for simple use cases and does not persist events. Handlers are executed synchronously in the publisher's goroutine.

func NewSimpleInMemoryEventBus

func NewSimpleInMemoryEventBus() *SimpleInMemoryEventBus

NewSimpleInMemoryEventBus creates a new SimpleInMemoryEventBus.

func (*SimpleInMemoryEventBus) Publish

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

Publish executes all registered handlers for a given event.

func (*SimpleInMemoryEventBus) Start

Start does nothing for this simple in-memory bus.

func (*SimpleInMemoryEventBus) Stop

Stop does nothing for this simple in-memory bus.

func (*SimpleInMemoryEventBus) Subscribe

func (b *SimpleInMemoryEventBus) Subscribe(ctx context.Context, eventName string, handler event.EventHandler) error

Subscribe registers an event handler for a specific event name.

func (*SimpleInMemoryEventBus) Unsubscribe

func (b *SimpleInMemoryEventBus) Unsubscribe(ctx context.Context, eventName string, handler event.EventHandler) error

Unsubscribe removes a specific event handler for an event name. Note: Unsubscribing based on function equality can be unreliable in Go. A more robust implementation would require handlers to have unique IDs.

Jump to

Keyboard shortcuts

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