broker

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 8 Imported by: 0

README

broker

Simple event broker

Documentation

Index

Constants

View Source
const ErrBrokerIsStopped = errors.Const("operation on stopped broker")

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker[T types.Ordered] interface {
	execs.Runner
	Subscribe(name string) (sub Subscription[T], err error)
	Publish(ev Event[T]) error
	Unsubscribe(sub Subscription[T]) error
}

Broker - simple service event broker

func New

func New[T types.Ordered](ctx context.Context, qsz int) Broker[T]

New - simple broker constructor

type Event

type Event[T types.Ordered] interface {
	SubName() string
	EventType() T
}

Event service event

type Subscription

type Subscription[T types.Ordered] interface {
	GetName() string
	ChanEv() chan Event[T]
}

Subscription - service event subscription

func NewSubscription

func NewSubscription[T types.Ordered](name string, sz int) Subscription[T]

NewSubscription - event subscribe constructor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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