← Lattice
Lattice · How messages travel
Lattice: The messenger. Carries news between every part so nothing is missed.
Lattice delivers every message in order and drops a slow listener instead of letting it hold everyone up.
How it goes, step by step
- 01A daemon module calls bus.publish(event_type, data)
- 02A memory-only type skips the log; any other type is numbered and written to event_log
- 03The event fans out to each matching subscriber queue; a full queue drops its oldest and the stream re-reads the log
- 04SSE clients on /api/events get frames whose id is the bus number
- 05Grant, Hank and the daemon each get their emitter from emitter_for(service)
- 06Until the ops bootstrap runs, each emitter holds its events (at most 256, oldest dropped)
- 07bootstrap_ops_emitter binds every handle to the daemon's MQTT client and instance
- 08Held events publish in emit order with their original ts and the bound instance; later events publish at emit time
- 09With no running event loop at the bind, held events are logged and not sent
- 10Each ops event goes out on kv/ops/events/<instance>/<service>/<event_type>
- 11bus_stream_api serves the local MxBus to peers on /api/bus/stream; bus_aggregator, which would pull peers in, is started by nothing
Production detail
The full production diagram — every part, sample message and watched file — is kept in the team library, reachable only from inside the private network.
Every page here is rebuilt automatically when the thing it describes changes, so what you read is what is true today.