Introducing AxonFramework Firestarter

The AxonFramework-Firestarter is a library that allows you to introduce some "taints" into your Axon Framework based application.

This feature is helpful for exploratory scenarios where we want to create controlled chaos (or start fires) inside our applications to test how our system will react under stress or when problems arise.

In this tutorial, we want to use AxonFramwork Firestarter to introduce delays or cause some message handlers to produce errors and see how AxonIQ Console detects and shows these situations.

Adding Axon Firestarter to your application

To add Axon Firestarter to your application, simply add the org.axonframework.firestarter:firestarter-spring-starter to your bike-rental application.

If you are using the Docker-based bike-rental demo that comes with AxonIQ Console ready to run and connect to the dashboard, you don’t need to do anything because the bike-rental demo Docker images with the different modules have been created with Axon Firestarter. You can jump right to Detecting Issues in your Application to see it in action.

The first thing we need to do is to declare the dependency management in the pom.xml of the root project:

/pom.xml
    <dependencyManagement>
        <dependencies>
			<dependency>
				<groupId>org.axonframework.firestarter</groupId>
				<artifactId>firestarter-spring-starter</artifactId>
				<version>0.0.2</version>
			</dependency>
        </dependencies>
    </dependencyManagement>

With this configuration, we can now add the dependency to any module in our project without specifying the version while keeping the versions in sync. So all you need to do is declare the dependency in your `payment' and `rental' modules:

/payment/pom.xml
    <dependencies>
        <dependency>
            <groupId>org.axonframework.firestarter</groupId>
            <artifactId>firestarter-spring-starter</artifactId>
        </dependency>
    </dependencies>
/rental/pom.xml
    <dependencies>

        <dependency>
            <groupId>org.axonframework.firestarter</groupId>
            <artifactId>firestarter-spring-starter</artifactId>
        </dependency>
    </dependencies>
If you split your rental module into the various microservices defined in the /microservices folder, you must add the dependency mentioned above to all the /microservices/rental-* modules.

Once you have added the dependency to your modules, update your Maven project and ensure AxonFramework Firestarter is listed among the libraries.

Accessing the Axon Firestarter console.

Once you have added the AxonFramework Firestarter library to your project, you can start your modules. You will have a dashboard accessible under /fire-starter/ to "start your little fires within the Axon Framework-based application."

For example, start your rental module and point your browser to https://localhost:8080/fire-starter/, you will see the following page:

Screenshot of the main page of the Axon Framework Firestarter attached to an Axon Framework-based application. The title of the page is 'AxonFramework FireStarter Rental Monolith'. Below the title are different sections (Events, Commands, Queries, Sagas, Token Store) with the components in the application that you can configure to change their performance.

If you are using the Docker-based bike rental demo application provided by the AxonIQ Console that is ready to run and connect to the Dashboard, you can access the Axon Firestarter page for each module at the following URLS:

This page will show you all the points where you can configure different degrees of problems or change the application’s performance to introduce some delays.

For example, if you click on the 'Event Handlers' button in the 'Events' section, you will see a panel that allows you to introduce fixed or random delays in the time that all the event handlers defined in this application take to process an event and configure them to produce an error in a certain percentage of the events that are processed.

Screenshot of the Event Handlers panel, which allows to introduce delays or configure error rates for all event handlers in the Axon Framework application.

For each problem you can configure (fixed delays, random delays, or error rate), you have a checkbox to enable the 'problem' and a field to configure the time or percentage of requests that will cause that problem.

Once you have configured your desired behavior, click the "Save taints" button and your application will start behaving the way you told Axon FireStarter to behave.

Conclusion

Now that you have configured Axon Firestarter in your application, we can start introducing problems in our applications and see how the AxonIQ Console helps us detect these problems in our applications' behavior.

We will guide you on how to do it in the Detecting Issues in your Application section.