mock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mock is the canonical in-process events.Broker: synchronous, in-memory fan-out. It is both the reference implementation module-to-module delivery uses in a single binary, and the test double consumers wire in place of a real broker.

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 delivers synchronously, in subscription order, to every Subscriber registered for an Event's Topic at the moment Publish runs. It never crosses a process boundary — that is github.com/tinywasm/sse's job.

func (*Broker) Publish

func (b *Broker) Publish(e events.Event)

Publish invokes every Handler subscribed to e.Topic, synchronously. A Handler that panics is not recovered: a broken subscriber must fail loudly, not be silently dropped from future delivery.

func (*Broker) Subscribe

func (b *Broker) Subscribe(topic string, h events.Handler)

Subscribe registers h for topic. Safe for concurrent use with Publish.

Jump to

Keyboard shortcuts

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