Search⌘ K
AI Features

Adding a New Order Search Module

Explore how to implement a new order search module by consuming event streams from multiple services to maintain local caches. Understand modular design decisions for independence and efficient data integration, enabling real-time, detailed search functionality without disrupting existing components.

Now that we are publishing the application state as it changes, we can consider new functionality that might have been impossible before or would have been too dependent on others to be feasible.

We will be consuming many different sources to keep a local cache to provide greater detail for our search results. Customer, store, and product names will all be stored locally. The new module will be consuming every message that the Order Processing module will be publishing to keep results current. Other data could also be included later, such as the status of the invoice, or the status of the shopping that takes place after the order has been submitted.

The data that feeds the Search module
The data that feeds the Search module

Search module setup

We will create the new module in a new directory called /search, and in that directory, we will create the module.go file exactly like the other modules. This new module will need the following driven adapters in ...