intermediateThe Materialized View Pattern

What is a materialized view in an event-driven microservices architecture?

A materialized view is a dedicated, pre-combined read model built ahead of time by listening to events, rather than assembled on demand at request time. Instead of a request handler calling several services fresh every time it needs combined data, a listener component subscribes to the relevant events as they happen and merges them into one ready-to-serve record. A request for that data then becomes a single, instant lookup against one table, with no cross-service calls, no request-time composition, and no dependency on every underlying service being available and fast at that exact moment. The trade-off is that the view is eventually consistent, since it's updated asynchronously as events arrive rather than reflecting the absolute latest state at the instant of the read.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why does replaying an aggregate's full event history on every command become a real problem, and how do snapshots fix it?← Back to all Event-Driven Microservices questions