CQRS + Axon + Spring Insight = ccale in complex domains


News: CQRS + Axon + Spring Insight = ccale in complex domains

  1. In a recent article, Joris Kuipers and Allard Buijze (two accomplished, Trifork software engineers) explain a) how Axon Framework is used to implement Query Command Query Responsibility Segregation (CQRS) and b) how Spring Insight can be used within the architecture. At a high level, the following five areas are covered: 

    • What is CQRS?
    • How to Apply CQRS
    • What are CQRS Benefits
    • Where Axon Framework fits with CQRS
    • How to get the Spring Insight Plugin for Axon 

    The following is a summary of the original article.

    The CQRS Design Pattern and Application

    CQRS is a design pattern that essentially does away with the notion of a single shared domain model that's used everywhere in an application. It introduces separate models for a) state-changing operations versus operations that b) only inspect the state of the system. These operations are respectively referred to as commands and queries and make up the acronym. The term was first coined by Greg Young, who's a strong advocate of the pattern, and is based on Bertrand Meyer's notion of Command Query Separation.

    CQRS is applied in a way that:

    • state changes are initiated in the form of commands
    • these commands trigger changes to the domain model that's used for updates, the so-called Command Model
    • this model is responsible for updating its state while guarding its consistency and triggering logic that's involved with processing the changes contained in the command
    • changes to the Command Model are propagated to the Query Model(s).
    • clients of the Query Models will now see the effect of the updates as they query the system.

    CQRS Benefits, Axon Framework, and Spring Insight

    CQRS can benefit developers in many ways. For example, software development can take a fundamentally different approach when updates are separate from queries—you can manage projects and development tasks differently. Here is a beautiful example of where CQRS can really benefit a development team over the lifecycle of an application—you build a CRUD-centric system in V01, then you add a complex notification model on top of it in V02, then you want a task-based GUI in V03, you add trend analysis in V04, you need to audit key events in V05, and you need real-time integration with another system in V06.

    Axon Framework is a Java framework which provides implementations of common CQRS building blocks and allows developers to focus on the business logic. For example, Axon provides a number of Command Bus implementations, ranging from the in-process SimpleCommandBus to the DistributedCommandBus, which allows a cluster of machines to distribute commands among each other.

    Axon has a Spring Insight Plugin that helps tie all of this together when developing. As a framework that operates at an infrastructure level, the operations that Axon performs as it handles the commands and events can provide a lot of insight into the application’s behavior. 

    Additional detail, links to Spring Insight downloads, and architecture diagrams are available in the original article.

  2. DDD with CQRS makes a great architecture that focuses on business values that does not need reliance on heavy frameworks. Don't know why these guys from the Axon framework push Spring so much, was going to look into it, but nevermind...