Decoupling Services for Efficient Communication
Events serve as facts and triggers, while commands are actions requesting a change in the system’s state. Queries are requests to retrieve information without modifying the system’s state. Remote queries introduce coupling and tie services together. We can internalize the queries to avoid this cross-context dependency, leading to a hybrid model. The event stream serves as a notification mechanism, allowing any service to tap into the flow while queries are directed to the source. Each service can query the stored information by caching datasets from the event stream.
Events represent immutable facts, capturing temporal behavior in related events. Limiting query interfaces to specific contexts and focusing on targeted views over shared data stores is crucial. Clustered contexts can be employed by utilizing event flows as the primary communication pattern between contexts. Event-driven processing and request-driven opinions should be used within each context as necessary.