esx

package
v0.0.0-...-f34e32e Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 6 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 interface {
	MessageBus
	Replay() iter.Seq[Message]
}

type InMemoryStore

type InMemoryStore struct {
	*SimpleMessageBus
	// contains filtered or unexported fields
}

func NewInMemoryStore

func NewInMemoryStore() *InMemoryStore

func (*InMemoryStore) Contains

func (store *InMemoryStore) Contains(message Message) bool

func (*InMemoryStore) Publish

func (store *InMemoryStore) Publish(ctx context.Context, message Message) error

func (*InMemoryStore) Replay

func (store *InMemoryStore) Replay() iter.Seq[Message]

type Message

type Message struct {
	Payload     any    `json:"payload"`
	Type        string `json:"type"`
	ReflectType reflect.Type
	Timestamp   time.Time
}

func NewMessage

func NewMessage(payload any) Message

type MessageBus

type MessageBus interface {
	Publish(ctx context.Context, message Message) error
	Subscribe(handler *MessageHandler)
}

MessageBus ist ein Interface den Nachrichtenaustausch

type MessageHandler

type MessageHandler struct {
	Type     reflect.Type
	TypeName string
	Handler  MessageHandlerFunc
}

func NewMessageHandler

func NewMessageHandler[T any](handler TypedMessageHandlerFunc[T]) *MessageHandler

type MessageHandlerFunc

type MessageHandlerFunc func(ctx context.Context, payload any) error

type SimpleMessageBus

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

SimpleMessageBus ist eine einfache Implementierung des MessageBus.

func NewSimpleMessageBus

func NewSimpleMessageBus() *SimpleMessageBus

NewSimpleMessageBus erstellt einen neuen SimpleMessageBus.

func (*SimpleMessageBus) Publish

func (qb *SimpleMessageBus) Publish(ctx context.Context, message Message) error

Publish veröffentlicht eine Nachricht auf dem Nachrichtenbus

func (*SimpleMessageBus) Subscribe

func (qb *SimpleMessageBus) Subscribe(handler *MessageHandler)

Subscribe aboniert Nachrichten und führt den Handler aus, wenn eine Nachricht eingetroffen ist.

type TypedMessageHandlerFunc

type TypedMessageHandlerFunc[T any] func(ctx context.Context, payload T) error

Jump to

Keyboard shortcuts

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