Code Samples
Where you can find different code examples for Axon Framework
Complete Projects
It's the implementation of the example used in this blog post: https://eventmodeling.org/posts/what-is-event-modeling/
This Axon Framework demo application focuses on a simple giftcard domain designed to show various framework aspects. The app can be run in various modes, using Spring-boot Profiles: by selecting a specific profile, only the corresponding parts of the app will be active. Select none, and the default behaviour is activated, which activates everything. This way, you can experiment with Axon in a (structured) monolith as well as in micro-services.
The files in this repo accompany the "Running Axon Server" Blog series.
- 1-local contains scripts and configuration files for running Axon Server as a local process.
- 2-docker contains the files for "pure" Docker.
- 3-k8s is all about Kubernetes deployments.
- The ee-image directory (under "2-docker") contains the files for making an Axon Server EE Docker image.
- Finally, the Axon Server QuickTest directory provides a small app to verify that Axon Server is up and running.
Please watch the full webinar that explains all parts of this demo project.
Monitoring stack includes Prometheus, Grafana & Alert manager. Metrics from Axon Framework and Axon Server will be scraped by Prometheus.
Maven Modules
This module's intention is to be used as a template to quickly start with a new Maven-based Axon application with Spring Boot, either in Java or Kotlin.
This simple app allows you to experiment with multi-tenancy feature in Axon Framework. By using Multitenancy extension this app can connect to multiple contexts at once dynamically. Using UI, explore how to create tenants in runtime and dispatch messages to them.
In this demo, we will show how to propagate errors as exceptions in a distributed environment. One of the most common ways to indicate that a logical error has occurred and that Command handling failed is to throw an exception from a Command handler. However, if the exception is directly serialized, there is no guarantee that the command sending side can properly deserialize the exception in question. That is why, by default Axon Framework will wrap any exception thrown inside a Command handler into a CommandExecutionException
.
This demo is meant to show how to reset a tracking token. There are 2 ways of doing that, using Axon Server API or just Axon Framework.
This is an example of how to implement a Saga. This use case is implemented in the ProcessOrderSaga. A Saga is responsible for the process between multiple bounded contexts. The Saga starts on the OrderConfirmedEvent which marks the start of the order process and contains the orderId
. An essential aspect of a Saga that is it needs to have an end. An everyday use case is to end a Saga after a certain amount of time.
A type of question that occurs a lot is How can I check if an account with a particular email address already exists?
. In essence, this signals the requirement to validate a set, which is a more intricate process when it comes to applications that follow the CQRS paradigm. Without going into full detail here why this is a problem, a straightforward solution is to enhance the command model by adding a small look-up table that can be queried during such a validation step. There are several ways to invoke this set validation when using Axon, several of which are shared in this repository.
In this demo we will try achieve that our REST API feels more native and on sending a command it returns updated projection right away, instead of listening for updates on a different endpoint.
This demo application aims to showcase how to stream the results from a Subscription Query to the UI.
This module's intention is to give insights on how to create an upcaster and how to test it. This example uses a JSON serializer.

September 28th, Amsterdam
Join us for the AxonIQ Conference 2023, where the developer community attends to get inspired by curated talks and networking.

September 27th, Amsterdam
The event to collaborate, discuss, and share knowledge about techniques, tools, and practices for building complex, distributed event-driven applications.