Building Read Models from Multiple Sources
Understand how to create read models by combining data from various sources within an event-driven architecture. This lesson shows how to build a rich search model using PostgreSQL, optimizing for efficient queries on orders with filters like customer, store, product, status, and date ranges, while handling data consistency and schema design challenges.
We'll cover the following...
The new Search module will return order data that should not require any additional queries to other services to be useful. We want to be able to return the customer’s name, product name, and store name in the details we return. We also want to be able to locate the orders using more than their identities.
The search goals of this new module are as follows:
Search for orders belonging to specific customer identities.
Search for orders by store and product identities.
Search for orders created within a date range.
Search for orders that have a total within a range.
Search for orders by their status.
The read model that we will be building is not too different from what an order in the Order Processing module looks like:
To support searching using the previously mentioned filters, we will be ...