Topic

io.eezo.live.Topic
final class Topic[A]

An in-process publish/subscribe topic, typed by its message.

A Topic[A] is a value the application creates and shares — a field on the app object, a per-entity lookup, whatever names it for both sides. Anything may publish: a handler, a component's handle, boot's background work. Only Component.init may subscribe, through Init, which is what keeps the subscription set from growing by one per re-render.

Delivery is a hand-off, never work: publish runs each subscriber's callback on the publisher's thread, and that callback — built by Init.subscribe — only enqueues into the page's mailbox. The re-render happens on the page's own thread (design/live.md §2.4), so a publisher holding a scarce resource (a database connection, mid-transaction) never renders pages with it.

Cross-node fan-out is a later implementation behind this same surface (design/live.md §2.8); nothing here names a transport.

Attributes

Source
Topic.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def publish(message: A): Unit

Delivers to every current subscriber. Fire and forget: a page that has since closed has already cancelled and is simply absent.

Delivers to every current subscriber. Fire and forget: a page that has since closed has already cancelled and is simply absent.

Attributes

Source
Topic.scala
def subscriberCount: Int

How many pages are listening. For tests and metrics, not for logic.

How many pages are listening. For tests and metrics, not for logic.

Attributes

Source
Topic.scala