Help us shape the future of Go! Take the 2026 Go Developer Survey

events

package
v0.9.78 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Permanent

func Permanent(err error) error

Types

type Backend

type Backend interface {
	Publisher() message.Publisher
	Subscriber() message.Subscriber
	Shutdown(ctx context.Context) error
}

type DeliveryPolicy

type DeliveryPolicy struct {
	MaxRetries            int
	InitialBackoff        time.Duration
	MaxBackoff            time.Duration
	DeadLetterTopicSuffix string
	CloseTimeout          time.Duration
}

type NoopEngine

type NoopEngine struct{}

func NewNoop

func NewNoop() *NoopEngine

func (*NoopEngine) Close

func (e *NoopEngine) Close() error

func (*NoopEngine) Publish

func (e *NoopEngine) Publish(_ string, _ ...*message.Message) error

func (*NoopEngine) Publisher

func (e *NoopEngine) Publisher() message.Publisher

func (*NoopEngine) Shutdown

func (e *NoopEngine) Shutdown(_ context.Context) error

func (*NoopEngine) Subscribe

func (e *NoopEngine) Subscribe(
	ctx context.Context,
	_ string,
) (<-chan *message.Message, error)

func (*NoopEngine) Subscriber

func (e *NoopEngine) Subscriber() message.Subscriber

type Option

type Option func(*Router)

func WithLogger

func WithLogger(logger *slog.Logger) Option

type Publisher

type Publisher interface {
	Publish(topic string, event []byte) error
}

type Router

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

func NewRouter

func NewRouter(backend Backend, policy DeliveryPolicy, opts ...Option) (*Router, error)

func (*Router) Publish

func (r *Router) Publish(topic string, event []byte) error

func (*Router) Shutdown

func (r *Router) Shutdown(ctx context.Context) error

func (*Router) Start

func (r *Router) Start(ctx context.Context) error

func (*Router) Subscribe

func (r *Router) Subscribe(
	topic string,
	handler func(ctx context.Context, event []byte) error,
) error

type Subscriber

type Subscriber interface {
	Subscribe(
		topic string,
		handler func(ctx context.Context, event []byte) error,
	) error
}

type TopicInitializer

type TopicInitializer interface {
	InitializeTopic(topic string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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