broker

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 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 struct {
	// contains filtered or unexported fields
}

Broker implements a non-blocking fan-out pub/sub for query events. Slow subscribers silently drop events to avoid blocking the publisher.

func New

func New(bufSize int) *Broker

func (*Broker) Publish

func (b *Broker) Publish(ev event.Query)

Publish sends an event to all subscribers. If a subscriber's buffer is full, the event is dropped for that subscriber.

func (*Broker) Subscribe

func (b *Broker) Subscribe() (<-chan event.Query, func())

Subscribe returns a channel that receives published events and an unsubscribe function. The unsubscribe function is idempotent.

func (*Broker) SubscriberCount

func (b *Broker) SubscriberCount() int

Jump to

Keyboard shortcuts

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