adesso Blog

How do you develop a highly available application that is both scalable and easy to maintain in today’s world? In this blog post, I will briefly explore approaches, methods and tools that I believe can be used to achieve this. I will also explain how domain-driven design (DDD) helps improve communication, how command query responsibility segregation (CQRS) reduces the complexity of large domain models and how event sourcing can be used to efficiently monitor the model state. Along with that, I will be presenting Axon as a comprehensive platform that includes Axon Framework and Axon Server.

Imagine you are given the task of developing a software solution to solve a complex business problem. Let us say you want to design an e-commerce platform that manages orders, checks stock levels and processes payments. But how do you ensure that the system is efficient, expandable and scalable? This is where DDD, an approach that focuses on modelling the business domain and improving communication between all stakeholders, comes into play.

Domain-driven design (DDD) as the key to efficient communication

DDD helps you create a common language and a common understanding between developers, experts and other stakeholders, allowing you to avoid misunderstandings and work more efficiently as a team. When it comes to developing an e-commerce platform, this means that the entire functionality and logic relating to orders, inventories and payments is clearly defined and understood.

Command query responsibility segregation (CQRS) as a way to reduce the complexity of large domain models

One challenge when modelling large domains involves the increasing complexity of the model. That is where CQRS comes into play. Under this approach, the application is divided into a command model and a query model. The former is responsible for carrying out tasks that change the domain, while the latter is in responsible for providing information, this being done by preparing the data in the form it will be needed later on. This approach significantly reduces the complexity of large domain models and improves scalability. This means that we can process orders efficiently with respect to our e-commerce platform, whilst at the same time quickly carrying out queries to get information on stock levels.

Events as the interface between the command and query model

However, splitting the application up raises a whole new problem relating to how you can ensure the models stay synced. This is where events have a role to play. These serve as the interface between the command model and the request model. As soon as the command model has executed a task, let us say the ‘Place order’ command, for example, it generates the ‘Order placed’ event. This event can then be processed by the query model to provide the data needed for fast queries. This way, the system remains consistent and synced.

Asynchronous communication and microservices

Another key feature of events is asynchronous communication between microservices. By using events as a communication mechanism, microservices can work independently of each other and exchange information via events. This means that a microservice can generate an event and send it to other microservices without waiting for them to process it then and there. Asynchronous communication improves the scalability and flexibility of the overall system and promotes loose coupling between the individual components.

Event sourcing for efficient model state tracking

Which leads us to event sourcing (ES), another high-effective strategy in this area. Under a more conventional approach, the current state of the model is saved. ES takes a different path here, one in which the events that have led up to this state are saved. These events are immutable, and if you run them in the right order, you will always get the current state of the model. In the case of our e-commerce platform, this means that we have a complete log of all orders, changes in stock levels and payments. These events open up the possibility of data mining and reporting while also enabling precise tracing and reconstruction of the system state at a specific point in time.

Axon as a comprehensive platform for DDD, CQRS and ES

However, it can be extremely difficult to implement DDD, CQRS and ES, a process requiring a large infrastructure and subject to a loss of control. But there is a way around these issues. That would be Axon, a platform offered by AxonIQ that was designed for this very purpose.

Components of Axon: Axon Framework and Axon Server

Axon consists of two components: Axon Server and Axon Framework.

  • Axon Server is a highly scalable, distributed event store system that allows users to store and provide events as well as forward commands and requests to the corresponding components in the system.
  • Axon Framework provides the modules necessary to implement DDD, CQRS and ES, enabling developers to focus on the actual domain logic.

Axon offers a number of other advantages. To give an example, it can be seamlessly integrated into existing cloud infrastructures such as Kubernetes, meaning that applications developed using Axon can be provided in a flexible, scalable way. Axon also offers a variety of add-ons for connecting third-party providers such as Kafka.

Conclusion

To recap, the combination of domain-driven design, command query responsibility segregation, event sourcing and the comprehensive Axon platform is a highly effective approach for developing modern, highly available applications.

The main focus here is on a uniform language, the separation of commands and query models, and the efficient modelling of model states by means of event sourcing. This allows you to keep the complexity under control and create the foundation for scalable, user-friendly systems.

As a platform, Axon makes it possible to implement these complex concepts. It also allows developers to focus on key aspects of their domain while benefiting from a robust infrastructure and seamless integration into modern cloud environments.

Would you like to learn more about exciting topics from the world of adesso? Then check out our latest blog posts.

Picture Tino   Kiemann

Author Tino Kiemann

Tino Kiemann has been working as a software engineer at adesso since 2022. His work focuses on the development of microservices. He is also intensively involved with DDD, CQRS, event sourcing and the Java framework Axon.


Our blog posts at a glance

Our tech blog invites you to dive deep into the exciting dimensions of technology. Here we offer you insights not only into our vision and expertise, but also into the latest trends, developments and ideas shaping the tech world.

Our blog is your platform for inspiring stories, informative articles and practical insights. Whether you are a tech lover, an entrepreneur looking for innovative solutions or just curious - we have something for everyone.

To the blog posts

Save this page. Remove this page.