Project Setup and Configuration
Set up the development environment, dependencies, and Ignite cluster
This module establishes the foundation for the transit monitoring application: project structure, dependencies, and a local Ignite cluster.
Getting the Source Code
Clone the GitHub repository:
git clone https://github.com/maglietti/transit-monitor.git
cd transit-monitorExplore the code and follow along with the tutorial using this repository.
Development Environment Options
While the tutorial uses Maven and command-line operations, adapt the approach to your preferred environment:
IntelliJ IDEA Setup
Open IntelliJ IDEA
Select File > New > Project from Existing Sources
Navigate to the cloned repository and select the
pom.xmlfileFollow the prompts to import the project
Run the examples from the IDE
Visual Studio Code Setup
Open VS Code
Use File > Open Folder and select the cloned repository
Install the Java Extension Pack if not already installed
Open the Maven extension to view and run the project goals
Use the Java extension to run the application
Using Other Editors
Navigate to the project directory in a terminal
Use command-line Maven to build and run the project
Directory Structure
The project structure is organized as follows:
Maven Configuration
The Maven pom.xml contains the necessary dependencies. Open it in your editor:
The key dependencies include:
Apache Ignite client library: Enables connection to an Ignite cluster
MobilityData GTFS-realtime API: Provides tools for parsing transit data
Log4j2: Implements structured logging for application events
dotenv-java: Manages configuration variables securely
After reviewing the pom.xml, run mvn verify from the project directory to download all dependencies.
Understanding Ignite's Client-Server Architecture
Apache Ignite 3 follows a client-server model:
Server Nodes: Form the distributed cluster where data is stored and processed
Clients: Lightweight connections that communicate with the cluster
The application uses the Java thin client API to connect to a cluster of Ignite server nodes running in Docker containers.
Setting Up the Ignite Cluster
Using the Docker Compose File
The repository contains a docker-compose.yml file that creates a three-node Ignite cluster on localhost. Each node is configured with:
4GB of memory allocation
Exposed HTTP and client ports
A shared configuration for node discovery
In-memory storage (no data is persisted to disk)
Starting the Ignite Cluster
Open a terminal in the directory containing the
docker-compose.ymlfileRun:
docker compose up -dVerify the status with:
docker compose ps
Expected output:
The cluster exposes two ports for each node:
10300-10302: REST API ports for administrative operations
10800-10802: Client connection ports for the Java application
Initializing the Cluster
Ignite 3 requires explicit cluster initialization, which configures the metastorage group responsible for system metadata.
Start the CLI in Docker:
Inside the CLI:
Connect to a node:
connect http://localhost:10300Initialize the cluster:
cluster init --name=ignite3 --metastorage-group=node1,node2,node3
The metastorage group defines which nodes store critical system information, with enough redundancy to maintain availability if one node fails.
Understanding the Ignite Connection Manager
With the cluster running, open IgniteConnectionManager.java in the repository:
The core connection code:
This code:
Uses the builder pattern to configure the connection
Specifies addresses for all three Ignite server nodes for redundancy
Configures a retry policy that automatically handles temporary connection issues
Creates a client that can be used throughout the application
The class implements AutoCloseable for proper resource management, ensuring connections are properly released when the application shuts down.
Testing the Connection
Run the connection example to verify connectivity to the Ignite cluster:
This command uses the predefined execution in the Maven POM file to run the ConnectExample class. Expected output:
Open ConnectExample.java to examine the connection logic:
The example:
Creates an instance of
IgniteConnectionManagerGets the Ignite client from the manager
Calls a method to display information about the cluster
Automatically closes the connection when done using try-with-resources
Next Steps
The development environment is now complete:
A three-node Ignite cluster running in Docker containers
A Maven project with all necessary dependencies
A reusable connection management class
A working example application that verifies connectivity
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

