envzn
0.8 · beta · not released

Library / Concurrency / Communication / MessageBroker

CLASS

MessageBroker

Typed broadcast pub/sub.

Constructors 1

INIT()

Methods 2

MODIFY METHOD publish(REFERENCE T value) RETURNS void
modifies

Fan value out to every live subscriber. Each subscriber gets its own clone (class T) or copy (primitive T); a closed (unsubscribed) channel is skipped. Walks the owned registry with a MUTABLE REFERENCE local cursor — ownership grants mutable access, so no SHARED carve-out is needed on the MessageBroker side.

MODIFY METHOD subscribe(int32 capacity, BackpressurePolicy policy) RETURNS Subscription[T]
modifies

Register a new subscriber with its own buffered channel. Returns a scope-bound Subscription holding a SHARED MUTABLE REFERENCE to the channel. The Subscription is created from the channel handle BEFORE the handle is moved into the registry — the heap channel object is not moved by the handle transfer, so the reference stays valid.