Fetching a Stream’s Current State

In Chapter 4, Projecting Data into Useful Shapes, you built eventually consistent View Data. That means that while they’ll eventually get current with everything that has been written in the system, there is no guarantee that at any particular point in time they represent the truth as best we know it. That works for View Data, but not so much for when you’re trying to decide, say, whether or not to process the $10 million wire transfer. We need to know the state of an entity right now.

Entity streams are inherently without shape, since they’re just append-only logs of immutable events. The log doesn’t directly give the state of an entity. It’s optimized for writing and not for reading. We need to shape that ...

Get Practical Microservices now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.