Prepare your Application for AxonIQ Console

This section will prepare and connect our Axon Framework-based application to AxonIQ Console. We will follow the steps provided by the AxonIQ Console interface after signing up and setting up our free AxonIQ Console account.

If you did not follow the Building A Bike Rental Application tutorial and you do not have an Axon Framework-based application ready to connect to AxonIQ Console, you can also use a docker-based bike-rental application that we have prepared for you to easily start and connect to AxonIQ Console. Just skip to Using Docker-Based Bike-Rental Demo section of this guide.

During the process of creating your account, AxonIQ Console presented you with the following panel to choose whether to "connect your application" or "start the demo".

Screenshot of the AxonIQ Console dialog showing two options for instructions on how to connect an application. On the left side, there is a blue button to 'Connect my application' and on the right side, there is a blue button with the text 'Start demo'.

The rest of this article corresponds to the instructions displayed when the "Connect my application" option is selected in this dialog.

If you prefer to explore AxonIQ Console features using the demo application and you clicked on the 'Start Demo' button, you may want to refer to Using Docker-Based Bike-Rental Demo instead.

Create AxonIQ Console workspace and environment.

After selecting the "Connect my application" option, the AxonIQ Console onboarding flow will ask you to name your "Workspace" and "Environment".

Workspaces are the way that AxonIQ Console groups and separates different applications. A good name for the workspace is the name of the project or software system that groups all the applications/modules that will connect to that space in AxonIQ Console.

In this case, we recommend that you use "Bike Rental" as the workspace’s name and click on the 'Continue' button.

Screenshot of the AxonIQ Console dialog asking for a project name to create a new workspace. The dialog shows a title that reads 'Let´s connect your application' and explains that the first step is to create a workspace. It suggests using the project name as the workspace name. Below is a field titled 'Project name' filled with the 'Bike Rental' text. Finally, there is an orange button to continue the process.

Add AxonIQ Console client library

After creating the workspace, we must prepare our application to connect to AxonIQ Console. The process depends on whether our Axon Framework-based application is built using Spring Boot or plain Java.

Screenshot of the AxonIQ Console dialog with the option to install the AxonIQ Console client library for SpringBoot or plan Java-based applications. On the left side is a button with the text 'Spring Boot starter' and on the right side another button with the title 'Java Configuration'.

In our case, we will use the Bike Rental application that we created during the Building A Bike Rental Application tutorial, built using Spring Boot, we should click the 'Spring Boot Starter' button.

The following screen instructs us to add the io.axoniq.console:console-framework-client-spring-boot-starter library to your application. The Axon Framework will use this library to connect to AxonIQ Console and send the necessary telemetry data from our application to check its behavior.

If you want to know what kind of data is collected and sent to AxonIQ Console by this library, you can check it in the Data sent to AxonIQ section of the AxonIQ Console Framework Client project repository in GitHub

So, go to the root pom.xml file of your bike-rental project and add the following:

/pom.xml
  <properties>
<console-framework-client.version>1.7.3</console-framework-client.version>
  </properties>

  <dependencyManagement>
      <dependencies>
          <dependency>
              <groupId>io.axoniq.console</groupId>
              <artifactId>console-framework-client-spring-boot-starter</artifactId>
              <version>${console-framework-client.version}</version>
          </dependency>
      </dependencies>
  </dependencyManagement>

With this dependencyManagement, we will ensure that the version of the a console-framework-client-* library is the same in all the modules we connect.

Next, add the library to the payment and rental modules. Go to their respective pom.xml files and add the following:

/rental/pom.xml
<dependencies>

    <dependency>
        <groupId>io.axoniq.console</groupId>
        <artifactId>console-framework-client-spring-boot-starter</artifactId>
    </dependency>
</dependencies>
/payment/pom.xml
<dependencies>
    <dependency>
        <groupId>io.axoniq.console</groupId>
        <artifactId>console-framework-client-spring-boot-starter</artifactId>
    </dependency>
</dependencies>
If you are using the version of the bike-rental application that has split the rental module into multiple microservices/rental-* modules, you should add the console-framework-client-spring-boot-starter library to the pom.xml of each microservice.
After adding the dependencies to your projects, update your Maven project and ensure that the console-framework-client-spring-boot-starter library is on the classpath of your modules.

Once you have added the dependency, click the Next Step button.

Configure AxonIQ Console credentials in your app

In this step, we will configure our rental and payment modules with the credentials to connect and send data to the workspace we created for our project.

The dialog AxonIQ Console displays in this step allows you to give the module a name and configure the amount of data you want to send to AxonIQ Console from the dead-letter queues.

Once you have provided this information, the panel below will update with the properties you need to configure in your applications' application.properties files.

Screenshot of the Configure AxonIQ Console dialog during the Connect My Application process. The dialog shows two fields to introduce the application name and a drop-down selector that allows you to select different levels of information to be sent from the dead-letter queues to AxonIQ Console. Below the fields, there is a box that contains the properties that must be added to the Axon Framework application to connect to AxonIQ Console.

The axoniq.console.credentials token is specific to your workspace and should never be shared publicly. The token will be the same for all the applications/modules that connect to the same workspace (in this case, for both the rental and payment modules), but it will be different for other projects or workspaces.

So, let’s add these properties to our rental' and `payment' modules. First, open the `application.properties file in your rental folder and add the following properties (copy and paste from the AxonIQ Console dialog above)

/rental/src/main/java/resources/application.properties
axoniq.console.application-name=Rental module
axoniq.console.credentials=<your credential token here>
axoniq.console.dlq-mode=NONE

Next, do the same with the application.properties file in the payment module:

/payment/src/main/java/resources/application.properties
axoniq.console.application-name=Payment module
axoniq.console.credentials=<your credential token here>
axoniq.console.dlq-mode=NONE
If you are using the version of the bike-rental application that has split the rental module into multiple microservices/rental-* modules, you will need to configure these properties in the src/main/resources/application.properties file for each microservice module.

Click on the Next button to continue.

Connect your application to AxonIQ Console

We have everything configured in our Axon Framework-based application to connect to AxonIQ Console. AxonIQ Console will now display a panel indicating that it is waiting for our application to connect.

Screenshot of the dialog box showing that AxonIQ Console is ready and waiting for the application to connect.

Now, all you need to do is run your local application. Start both the payment and rental modules from your IDE as we did in the Running your application in your local environment with Docker Compose step of the tutorial.

After launching the applications, you should see the connection in AxonIQ Console:

Screenshot of the AxonIQ Console page showing that both the Payment and Rental modules are connected. The page also shows an orange button at the bottom right labeled 'Go to my workspace

You are ready to monitor your application with AxonIQ Console

Congratulations, you have connected your Axon Framework-based applications to AxonIQ Console.

Click on the "Go to my workspace" button to access all the information provided by AxonIQ Console from your application. This will display the main AxonIQ Console dashboard for your application:

Screenshot of the main AxonIQ Console dashboard with the Payment and Rental modules connected.

The dashboard contains several tabs that group the information collected from the modules that are connected to AxonIQ Console. These tabs and the information they contain are briefly described in the AxonIQ Console Getting Started Guide

You can explore a little bit the information provided in the different tabs, but since the application is idle, the information will not be much useful at this time.

If you are using your own application it would be useful to have a script that invokes some of the endpoints of the application to keep it under certain workload.

If you are using the bike-rental demo application you developed following the Building A Bike Rental Application tutorial, you can also check the Activity Simulator we have in the bike-rental GitHub repository (take a look at the Simulator and SimulatorConfigController classes and also the application-simulator.properties file)

If you are using the docker-based bike-rental demo application provided by AxonIQ Console, you are lucky, as this version already has the activity simulator included.