Skip to main content

Use the Atoti Starter

In a Spring application, the different components used in distribution like the messenger will be automatically created by Atoti starter for Spring Boot com.activeviam.springboot:atoti-server-starter. Import this dependency in your project to perform this injection.
In the context of tests, Atoti comes with the class com.activeviam.atoti.server.test.api.DistributionTestHelper handling this setup. See the specific section for details about its setup and usage.

Configure your application

The first step to define an application is to define a database. This is done like in a non-distributed application (see Database Overview) The second step is to define the data nodes and the query nodes. Here as an example of a data node definition:
The cluster can define its messenger with a protocol path or simply call the withLocalMessenger or the withNettyMessenger methods. This is the moment to conceal the hierarchies or the branches if it applies here (see Recommendations) And of a query node definition:
The query node will see all the data nodes belonging to the applications listed in its configurations. Once the nodes have been defined, they should be added to a manager:
The last step is to put the database and the manager together in an application:

Join/Leave a cluster

It is possible to join and leave the cluster programmatically like this:
If a data node leaves the cluster before sending all the expected query results to a query node, a ServiceUnavailableException is thrown.