Axon Part 1: An Introduction to Axon Framework

Reading Time: 3 minutes

This is the first part of an ongoing series of blogs explaining Axon Framework. This blog will help you get started with axon and get a basic understanding of the same.

Axon Header Image


Understanding Axon requires a basic knowledge of a few Axon concepts. Those are:

  • Microservices
  • Command Query Responsibility Segregation(CQRS)
  • Commands, Events and Queries
  • Domain Driven Design(DDD)
  • Event Sourcing
  • SAGA Design Pattern



The demands of software projects is increasing at a very high pace. Which means projects and code bases are getting more complex with functionalities being constantly added and/or changed. At this point a seemingly easy-to-implement feature can require development teams to take apart an entire application. Also, today’s web applications target the audience of potentially billions of people, making scalability an absolute must requirement.


The (Command Query Responsibility Segregation) CQRS pattern addresses these issues by drastically changing the design of the applications. Instead of separating logic into separate layers, logic is separated based on whether it is changing an application’s state or querying it. While executing commands, the query components update asynchronously using events. This mechanism of updates through events, is what makes this architecture so extensible, scalable and more maintainable.

So Why do we need Axon?

CQRS is fundamentally different than the layered-architecture which makes it difficult for developers to navigate around this architecture.

Axon Framework is designed to support developers to apply the CQRS/DDD architectural pattern and Event Sourcing.It helps developers build easily scalable and maintainable applications by providing implementations of some basic building blocks, such as Aggregates, repositories and event buses (the dispatching mechanism for events). 

Axon also provides annotation support, which can be used to build aggregates and event listeners without using Axon specific logic. This allows developers to focus on the business logic, instead of the plumbing, and helps you to make your code easier to test in isolation.

Axon Architecture

Axon Architecture

As we can see in the above image the command side and query side is clearly separate.

Axon separates Messages in roughly three categories:

Commands: Desire of a component to change something in the system. Routed to a single destination and may provide a response.

Queries: Represent a need for information. May route to one or more destinations depending on dispatch strategy.

Events: Represent the occurrence of something which might be of importance for other components. Events are published to any component interested and do not provide any form of return value.

Axon strongly recommends use of explicit message objects. Each Message in an Axon based application represents a specific Java Class in that application. This increases the writing overhead but in turn comes with a few advantages:

  • Use of explicit messages makes it easier to transparently distribute them to remote components.
  • Use of explicit messages is important in the long-term maintainability of an application.
  • Location Transparency: components that interact with each other don’t need to know the location of their counterpart.

Quick Start

Now, lets start setting up axon in our system.

Axon provides a Quick Start Toolkit for setting up Axon Framework and Axon Server SE (Standard Edition).

Note: It requires Java 8+ JRE in your system.

Download here:

This package contains:

  • Axon Framework Binaries
  • Axon Server SE
  • Gift card sample application
  • Getting started guide

After Downloading, follow the steps below to run it:

  • Unzip
  • Run the Axon Server:
$ java -jar AxonServer/axonserver-VERSION.jar
$ cd giftcard-demo && ./mvnw spring-boot:run

Note: If you’re on JAVA 8 please make the following changes:

  • In the extracted folder, open giftcard-demo\pom.xml with an editor or IDE whichever you prefer.
  • Change<java.version>11</java.version> to <java.version>1.8</java.version>
  • Find the maven-compiler-plugin block
  • Replace <release>${java.version}</release> with <source>${java.version}</source> <target>${java.version}</target>
  • Now it should run.

For detailed information please go through the

You can visit axon official documentation here:

This introduction guide will help you get started with Axon. To Know more, please visit Knoldus Blogs for the next part in this series.

Written by 

Agnibhas Chattopadhyay is a Software Consultant at Knoldus Inc. He is very passionate about Technology and Basketball. Experienced in languages like C, C++, Java, Python and frameworks like Spring/Springboot, Apache Kafka and CI/CD tools like Jenkins, Docker. He loves sharing knowledge by writing easy to understand tech blogs.

1 thought on “Axon Part 1: An Introduction to Axon Framework4 min read

Comments are closed.