10.5 Topics — cluster-wide fan-out
A topic is a distributed broadcast with storage in the built-in storage.
@retain(ORDER_EVENTS_RETENTION)
topic OrderEvents: OrderEvent sharded by .userId
emit OrderEvents(e) // publication
for await e in OrderEvents.subscribe(key: uid, from: .Latest) { … }
for await e in OrderEvents.subscribe(group: "indexer") { index(e) }emit T(x)orT.publish(x)publishes an item. Insideatomic(db)publication goes through the outbox (§11.2).- Broadcast semantics: every subscriber without a
groupreceives every item. Subscribers with the samegroupshare the items: each item is received by exactly one member of the group (a queue). sharded by .fieldis the partitioning key; order is guaranteed within a key. Without a key — one partition, total order.- The read start
from:.Latest,.Earliest,.Offset(n),.Since(time). A topic subscription is always resumable. - Delivery is at-least-once. Retention is
@retain(d)or@retain(count: n), by default the cluster'sTOPIC_RETENTION. - The item type MUST be
Serializable. A role withjournalMUST exist for a topic (§12.1).
Related diagnostics
See also
Source: docs/spec/oxl-standard.en.md