Part 4 - From coordination acts to event-driven systems, by Maurice Driessen, published November 21, 2024

While we have already established how coordination acts in the Complete Transaction Pattern (CTP) can be interpreted as business events in an event-driven architecture, it’s crucial to explore how these concepts integrate into modern enterprise systems, particularly through the Command Query Responsibility Segregation (CQRS) and Event Sourcing (ES) architectural patterns. These patterns help bridge the structured nature of DEMO’s transactional model with the dynamic, real-time capabilities of event-driven systems, ensuring scalable and responsive enterprise solutions.

Introducing CQRS and Event Sourcing

The CQRS pattern 1 separates the responsibility of handling commands (changes to the system) from queries (read operations), allowing for greater flexibility, scalability, and performance optimization. In a CQRS architecture, the system is divided into:

  • Command Side: Responsible for handling commands that mutate the state of the system. Commands correspond to the coordination acts we’ve already discussed, such as a Request Act (e.g., a customer placing an order) or a Promise Act (e.g., an executor confirming an order).
  • Query Side: Dedicated to serving queries by providing the current state of the system. This part is optimized for reading data, and used to present information from the Fact Model to support coordination acts.
Figure 5 CQRS Pattern
Figure 6 Event Sourcing

Event Sourcing (ES) 2 [MF, 2005] complements CQRS by ensuring that every change to the system’s state is captured as an event, rather than overwriting data. Instead of storing just the current state of a transaction, the entire sequence of events is saved, allowing the system to “replay” events and rebuild the state as needed. This approach aligns with CTP’s revocation capability, by maintaining a comprehensive history of all changes, allowing for the accurate replay and adjustment of transactions when acts are revoked. This ensures that the system’s state is consistently updated and reflective of any modifications or cancellations during the execution of the end-to-end business process.

Example: Applying CQRS/ES in an E-commerce Platform

Let’s revisit the earlier example of an e-commerce platform transitioning to a microservices architecture. In a CQRS/ES pattern:

This separation of command and query functions ensures the system remains performant and scalable, even as the volume of transactions increases. Additionally, it allows for real-time feedback to users, enhancing the overall user experience, as discussed in the next chapter about Event Modeling and View Modeling.

Transitioning to Event and View Modeling with DEMO Aspect Models

As we move forward to explore Event Modeling and View Modeling, the CQRS/ES architecture provides a clear framework for mapping DEMO’s aspect models into the enterprise solution architecture:

By leveraging CQRS and Event Sourcing, enterprises can ensure that the underlying architecture not only supports complex transactional processes but also enables agility, scalability, and real-time responsiveness.

Unlock Exclusive Insights!

If you’re eager to dive deeper into the methodologies and strategies discussed in this series, we invite you to request a copy of the comprehensive whitepaper, containing all the articles in this series. To get your copy, simply fill out our form here. Don’t miss out on the opportunity to enhance your understanding and transform your organization!

References

  1. Fowler, Martin (2012). CQRS. https://martinfowler.com/bliki/CQRS.html last visit 18oct2024 ↩︎
  2. Fowler, Martin (2005). Event Sourcing. https://martinfowler.com/eaaDev/EventSourcing.html last visit 18oct2024 ↩︎