event

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationEvent

type ApplicationEvent interface {
	EventSource() any
	EventTime() time.Time
}

type AsyncTypedPublisher

type AsyncTypedPublisher[E ApplicationEvent] interface {
	PublishEventAsync(ctx context.Context, event E) error
}

type Listener

type Listener interface {
	OnEvent(ctx context.Context, event ApplicationEvent) error
	SupportsEvent(event ApplicationEvent) bool
}

func Listen

func Listen[E ApplicationEvent](handler func(ctx context.Context, event E) error) Listener

type Multicaster

type Multicaster interface {
	AddEventListener(listener Listener) error
	MulticastEvent(ctx context.Context, event ApplicationEvent) error
	MulticastEventAsync(ctx context.Context, event ApplicationEvent) error
	RemoveEventListener(listener Listener) error
	RemoveAllEventListeners()
}

type Publisher

type Publisher interface {
	PublishEvent(ctx context.Context, event ApplicationEvent) error
	PublishEventAsync(ctx context.Context, event ApplicationEvent) error
}

type SimpleMulticaster

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

func NewSimpleMulticaster

func NewSimpleMulticaster() *SimpleMulticaster

func (*SimpleMulticaster) AddEventListener

func (m *SimpleMulticaster) AddEventListener(listener Listener) error

func (*SimpleMulticaster) MulticastEvent

func (m *SimpleMulticaster) MulticastEvent(ctx context.Context, event ApplicationEvent) error

func (*SimpleMulticaster) MulticastEventAsync

func (m *SimpleMulticaster) MulticastEventAsync(ctx context.Context, event ApplicationEvent) error

func (*SimpleMulticaster) RemoveAllEventListeners

func (m *SimpleMulticaster) RemoveAllEventListeners()

func (*SimpleMulticaster) RemoveEventListener

func (m *SimpleMulticaster) RemoveEventListener(eventListener Listener) error

type TypedPublisher

type TypedPublisher[E ApplicationEvent] interface {
	PublishEvent(ctx context.Context, event E) error
}

Jump to

Keyboard shortcuts

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