Create a docker-compose.yml file in the root directory:
Start Kafka and ZooKeeper using Docker Compose:
Create the vehicle-location topic:
3. Set Up Cassandra
You can set up Cassandra either manually or using Docker.
Option A: Manual Setup
Download and install Apache Cassandra from the official website.
Start the Cassandra server:
Set up the keyspace and tables for storing vehicle data:
Option B: Setup with Docker
If you prefer using Docker, follow these steps:
Create a docker-compose.yml file in the root directory (or update the existing one):
Start Cassandra using Docker Compose:
Access the Cassandra CQL shell:
Set up the keyspace and tables as described above.
4. Configure the Application
Update the application.properties file in the Spring Boot project to configure Kafka and Cassandra settings:
5. Back-End (Spring Boot)
Navigate to the backend directory and build the Spring Boot application:
The backend will start up and begin processing data from Kafka, storing it in Cassandra, and exposing RESTful APIs for the front-end.
6. Front-End (Angular)
Navigate to the frontend directory, install dependencies, and start the Angular application:
The front-end will start on http://localhost:4200 and will connect to the Spring Boot backend to visualize the real-time vehicle data on an interactive map.
Configuration
Kafka Configuration
Ensure Kafka is properly configured in the application.yml file. Key configurations include:
Bootstrap Servers: The address of the Kafka server (default: localhost:9092).
Consumer Group ID: The ID for the Kafka consumer group that processes vehicle location data.
Topic Names: The name of the topic (vehicle-location) that holds vehicle data.
Cassandra Configuration
Configure Cassandra in the application.ymlfile to connect to the correct database instance:
Contact Points: The IP address of the Cassandra server (default: 127.0.0.1).
Port: The port on which Cassandra is running (default: 9042).
Keyspace Name: The keyspace name (transitpulse) where vehicle data is stored.
Schema Action: Set to update to ensure that the database schema is updated automatically.
Running the Application
After completing the above steps, the TransitPulse system should be up and running. Access the front-end at http://localhost:4200 to see real-time public transport vehicle tracking in action.