Lattice

EventBus Internals

Deep dive: subscriber queues, slow-consumer drop, MQTT bridge.

EventBus Internals (v2026-09-30T102200Z-5e473105f4) 2026-09-30 | Deep dive: subscriber queues, slow-consumer drop, MQTT bridge. 1 - EventBus - Event Publishing and Subscription daemon/src/event_bus.py bus.publish() GET /api/events kv/events/{event_type} graphify-out/*.json event_bus_lvc.db MQTT Broker kv/events/{event_type} event SSE frame 2 - EventEmitter - Event Emission Infrastructure daemon/src/event_emitter.py emitter.emit() kv/mona/events/{instance}/{service}/{event_type} MQTT Broker kv/mona/events/{instance}/{service}/{event_type} event 3 - Bus Aggregator - SSE Aggregation daemon/src/bus_aggregator.py _peer_loop() kv/{machine}/bus/connected kv/{machine}/bus/disconnected ~/.kevin/holon-peers.json holon-peers.json Peer Daemon GET /api/bus/stream SSE frame event 1. Publish event to EventBus 2. EventBus routes event 3. EventEmitter emits event 4. Bus Aggregator aggregates S… 5. MQTT Broker publishes messa… 6. Peer Daemon receives message EventBus Publish Payload { "e": "holon:queued", "ts": 1672531200.0, "id": "123e4567-e89b-12d3-a456-426614174000", "holon_id": "...", "to": "flynn" } EventEmitter Emission Payload { "ts": "2026-05-12T16:30:00+00:00", "instance": "instance-a", "service": "daemon", "event_type": "startup", "severity": "info", "subject": "Daemon boot sequence complete", "payload": { "version": "0.1.0", "uptime_s": 0 } } EventBus uses asyncio for thread-safe operations. EventEmitter supports different severity levels with alert routing. Bus Aggregator handles reconnection with exponential back-off. Legend actor = initiates work · process = code path · store = state on disk · bus = durable queue · dashed = separate process cyan = request flow · pink = state read/write · dashed green = pull / return path · red = refusal As of 2026-09-30 10:22 UTC, from commit 5e47310

Provenance

This drawing is generated, not drawn. It is rebuilt from the source files below, so when they change the picture changes — a diagram here cannot quietly describe a system that no longer works this way.

Owner
Lattice
Slug
event-bus-internals
Rendered
2026-09-30T102200Z
From commit
5e473105f4
Updated
30 Sep 2026, 10:22 UTC
Sources at
5e47310
Watches
5 paths
  • daemon/src/event_bus.py
  • daemon/src/event_emitter.py
  • daemon/src/event_types.py
  • daemon/src/bus_aggregator.py
  • daemon/src/bus_stream_api.py