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

pubsub

package
v0.290.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker[T any] struct {
	// contains filtered or unexported fields
}

func NewBroker

func NewBroker[T any]() *Broker[T]

func NewBrokerWithOptions

func NewBrokerWithOptions[T any](channelBufferSize, maxEvents int) *Broker[T]

func (*Broker[T]) GetSubscriberCount

func (b *Broker[T]) GetSubscriberCount() int

func (*Broker[T]) Publish

func (b *Broker[T]) Publish(t EventType, payload T)

func (*Broker[T]) Shutdown

func (b *Broker[T]) Shutdown()

func (*Broker[T]) Subscribe

func (b *Broker[T]) Subscribe(ctx context.Context) <-chan Event[T]

type Event

type Event[T any] struct {
	Type    EventType
	Payload T
}

Event represents an event in the lifecycle of a resource

type EventType

type EventType string

EventType identifies the type of event

const (
	CreatedEvent EventType = "created"
	UpdatedEvent EventType = "updated"
	DeletedEvent EventType = "deleted"
)

type Publisher

type Publisher[T any] interface {
	Publish(EventType, T)
}

type Suscriber

type Suscriber[T any] interface {
	Subscribe(context.Context) <-chan Event[T]
}

Jump to

Keyboard shortcuts

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