Order guarantees and $all stream

Hi, so I know that ordering is only guaranteed within a single stream, but I want to get some confirmation that if an event “causes” another event to happen and these are in different streams, when reading from $all, I will receive the “cause” event before the “effect” event.

Let’s say I have a component that is subscribed to the $all stream (catch-up subscription), and upon receiving event A20 originally in stream “A” it spawns commands that result in other events (event B1 and event C9 in streams “B” and “C”) being written into different streams.
Can I assume, that after a restart, when subscribing to $all again I will get event A20 before event B1 and event C9?
I think it’s a reasonable assumption, but I want to be 120% sure.

$all has consistent ordering, meaning you’ll always get the events in the same order)
it’s basically the order in which events were committed into the data store.

1 Like

Just one thing to add there is unlike any other stream, which is a virtual concept (an index), the $all stream has the strongest ordering guarantee as it represents the physical event log written to the disk. Events in the $all stream simply cannot be out of order, it’s physically impossible.

2 Likes