Documentation
¶
Overview ¶
Package stream composes durable event history with the live event bus into a single, ordered stream for external consumers (API, CLI, inspector). It is the only place that combines event.Store replay with event.Bus subscription.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Subscribe ¶
func Subscribe(ctx context.Context, bus *event.Bus, store *event.Store, executionID core.ID, after core.ID) (<-chan Message, error)
Subscribe delivers every event for the execution: persisted history first (with an optional resume cursor), then live bus events. Events already delivered are skipped when they arrive again from the other source, so clients see each event exactly once. The returned channel is closed when ctx ends or the subscription is released.
History is not a one-time snapshot. The bus hands an event to the persister and to live subscribers independently, so an event published just before a consumer subscribes can still be missing from the store when the first history read happens. That event is then visible to neither the subscription nor the snapshot, and a consumer waiting for the terminal event waits forever. The stream therefore reconciles with the store while it is live rather than trusting the initial snapshot.