In order to prevent serving stale results, I’m using position to track where the Read Model is “up to” like so.
- Write returns position
- Position is sent back to the client
- Client makes a query and forwards the position it received
- If client Position is greater than Read Model Position the result is stale
Now the problem comes from the Read Model being built using a CatchUpSubscription, because if an event happens to be handled with catchup (as opposed to live) the OriginalPosition is null. I haven’t been able to figure out how to get it. So the Read Model doesn’t know the position of the event, therefore, you can’t tell if a query is stale or not.
Is there something I’m missing or is there a way to get the OriginalPosition?