partybus

package module
v0.0.0-...-205a760 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 3 Imported by: 6

README

gopartybus

An event bus in go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsubscribe = fmt.Errorf("unable to find subscription to unsubscribe")

Functions

func Join

func Join(cs ...<-chan Event) <-chan Event

Types

type Bus

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

func NewBus

func NewBus() *Bus

func (*Bus) Close

func (bus *Bus) Close()

func (*Bus) Publish

func (bus *Bus) Publish(event Event)

func (*Bus) Subscribe

func (bus *Bus) Subscribe(eTypes ...EventType) *Subscription

func (*Bus) Unsubscribe

func (bus *Bus) Unsubscribe(sub *Subscription) error

type Event

type Event struct {
	Type   EventType
	Source interface{}
	Value  interface{}
	Error  error
}

type EventType

type EventType string

type Handler

type Handler interface {
	Handle(Event) error
}

type Publisher

type Publisher interface {
	Publish(Event)
}

type Responder

type Responder interface {
	RespondsTo() []EventType
}

type Subscriber

type Subscriber interface {
	Subscribe(...EventType) *Subscription
}

type Subscription

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

func (*Subscription) Events

func (s *Subscription) Events() <-chan Event

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe() error

type SubscriptionId

type SubscriptionId int64

type Unsubscribable

type Unsubscribable interface {
	Unsubscribe() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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