Skip to main content

StreamResolver

Trait StreamResolver 

Source
pub trait StreamResolver<State> {
    // Required method
    fn discover_related_streams(&self, state: &State) -> Vec<StreamId>;
}
Expand description

Trait for runtime stream discovery when static declarations are insufficient.

Commands implement this trait when related streams cannot be known at compile time (for example, when a customer ID needs to be resolved from reconstructed state). Executors call this hook after reading declared streams so commands can request additional stream IDs to load before running business logic.

Implementations should return unique stream IDs; the executor deduplicates defensively but redundant IDs still waste I/O. Streams listed here are folded into the state reconstruction pass and participate in optimistic concurrency along with the statically declared streams.

Required Methods§

Discovers additional stream IDs to load based on reconstructed state.

Implementors§