OxL Reference

10.5 Topics — cluster-wide fan-out

A topic is a distributed broadcast with storage in the built-in storage.

oxl
@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) or T.publish(x) publishes an item. Inside atomic(db) publication goes through the outbox (§11.2).
  • Broadcast semantics: every subscriber without a group receives every item. Subscribers with the same group share the items: each item is received by exactly one member of the group (a queue).
  • sharded by .field is 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's TOPIC_RETENTION.
  • The item type MUST be Serializable. A role with journal MUST exist for a topic (§12.1).

topic-without-journal

See also

Source: docs/spec/oxl-standard.en.md