This section provides guidance on how to create your first Kaa application that will work with the Kaa platform. In this guide we will show you how to create a simple desktop java application that will receive notifications from the Kaa server and display them on the console. We will define our own notification schema and use the generated java classes within our application.
Installation and configuration
However, we recommend that you start exploring Kaa using Sandbox. Kaa Sandbox is an easy-to-use virtual environment that includes all the components that you need in order to learn Kaa, build a proof of concept and test your own applications locally. Sandbox also includes demo client applications.
The Sandbox setup procedure is straightforward and can be done instantly. See Sandbox for details.
Your first Kaa application
To register a new application within a fresh Kaa server installation, you need to create users with the tenant administrator and tenant developer roles. The tenant administrator is responsible for creating new applications in Kaa, and the tenant developer configures and generates SDKs for those applications. We suggest that you use Kaa Sandbox, which has a tenant administrator and tenant developer users already created.
To add an application, proceed as follows:
- Open the Kaa admin UI in your browser ( http://127.0.0.1:8080 ) and log in as a tenant administrator (user/password: admin/admin123).
- Select Applications on the navigation panel on the left side and, in the Applications window that opens, click Add new application.
- In the Add new application window, fill in the fields as required and then click Add.
After the application has been added, you may log out. We will not be using the tenant administrator role in this guide anymore.
Create notification schema
The application that you have created in the previous step already includes the default versions of the profile, configuration, notification and log schemas ready for use. However, in this sample application, we will use a custom notification schema for demonstration purposes. To create and upload the schema, proceed as follows:
Create the schema.json file on your PC with the following schema definition:
- Open the admin UI in your browser ( http://127.0.0.1:8080 ) and log in as a tenant developer (user/password: devuser/devuser123).
- Open the relevant Notification schemas window (Applications => My First Kaa Application => Schemas => Notification) and click Add new schema.
- In the Add new schema window, fill in the fields as shown in the following screenshot and then click Add.
As a result of this operation you will see two notification schemas in the list:
In this screenshot, version 2.0 is the notification schema that was just created. We will use this version for the SDK generation in the next step.
To generate the SDK for the new application, proceed as follows:
- Select the My First Kaa Application application and click Generate SDK.
- In the Generate SDK window, fill in the fields as shown in the following screenshot and then click Generate SDK.
After the SDK is generated, you will be presented with a window asking you to save a .jar file with the generated SDK. Specify the file name and location on your computer and then click Save. The SDK is now downloaded to your computer.
Please note that we are generating an SDK based on the default configuration, profile, and log schemas. These schemas are automatically populated during the application's creation. If necessary, you can overwrite them using the admin UI.
Sample client application
Once you have downloaded the SDK, you can use it in your sample project. The following code block illustrates a simple desktop java application that will receive notifications from the Kaa server and display them on the console.
You can find the project source code in the attached archive. The project is built using Apache Maven. Please note that the downloaded SDK must be placed into the lib folder in order for the build to work.
Please import this project into your IDE as a Maven project and launch the NotificationSystemTestApp application. Once application is launched, you will see the following output in the application:
Create notification topic
To send your first Kaa notification, you need to create a notification topic and assign this topic to the default endpoint group.
To create a notification topic, proceed as follows:
- Open the relevant Notification topics window (Applications => My First Kaa Application => Notification topics) and click Add new notification topic.
- In the Add notification topic window, fill in the fields as shown in the following screenshot and then click Add.
NOTE: We set the topic as mandatory in order to automatically subscribe the client application to notifications on this topic.
Once the topic is created, we will assign it to the default endpoint group, which contains all endpoints, including endpoints with our application.
To assign a notification topic to the default endpoint group, proceed as follows:
- In the relevant Endpoint groups window (Applications=>My First Kaa Application=>Endpoint groups), select the All group.
- In the Endpoint group details window, click Add notification topic at the bottom of the window.
- In the Add topic to endpoint group window, select the recently created notification topic and then click Add.
After the topic is added to the endpoint group, you will see the following output in the application:
This is the first update from the Kaa server that provides the client with the information about the changes in the topic list. Now you can send notifications on this topic, and they will be delivered to your application.
To create a notification, proceed as follows:
Create a notification.json file on your PC with the following contents:
- Open the relevant Notification topics window (Applications => My First Kaa Application => Notification topics) and click Send notification in the Notification Topic row.
- In the Send notification window, fill in the fields as shown in the following screenshot and then click Send.
Once the notification is sent, you can see the following output in the application:
Congratulations with your first Kaa application!
Use the following guides and references to make the most of Kaa.
|Guide||What it is for|
|Design reference||Use this reference to learn about features and capabilities of Kaa (Endpoint profiling, Events, Notifications, Logging, and other features).|
|Sandbox||Use this guide to try out Kaa in a private environment with demo applications.|
|Development environment setup||Use this guide to set up necessary environment for installing and programming Kaa.|
|Installation guide||Use this guide to install and configure Kaa either on a single Linux node or in a cluster environment.|
|Contribute to Kaa||Use this guide to learn how to contribute to Kaa project and which code/documentation style conventions we adhere to.|
If you have any questions or need assistance, do not hesitate to use our forum.
Also, we will appreciate it if you help us improve the quality of this guide. Please let us know via email about any typos or factual mistakes that you find.
Thank you for using Kaa!