Skip to content

davidimre/Distributed-Systems-Project-2

Repository files navigation

⚡ Energy Management System (Stage 2: Async Communication)

🚀 Overview

This project extends the distributed Energy Management System by introducing Asynchronous Communication and Event-Driven Architecture. While the first stage focused on user/device management, this stage adds real-time monitoring capabilities.

The system now processes streams of energy data from smart meter simulators using RabbitMQ as a message broker. It also implements cross-service synchronization to ensure data consistency across the distributed database landscape.

🏗️ New Architecture Components

In addition to the User and Device microservices (from Assignment 1), the system now includes:

  1. RabbitMQ (Message Broker):
    • Decouples the system components.
    • Manages two primary queues: sensor-data-queue (for high-volume metering data) and sync-queue (for system-wide consistency events).
  2. Monitoring Microservice (Consumer):
    • Role: Subscribes to the sensor-data-queue.
    • Logic: Receives energy measurements every 10 minutes, aggregates them into hourly energy consumption totals, and stores them in the Monitoring Database.
  3. Device Data Simulator (Producer):
    • A standalone application that mimics a smart energy meter.
    • Generates realistic consumption patterns (e.g., peak usage in evenings, low usage at night) and pushes JSON payloads to RabbitMQ.
    • Configurable: Reads target Device IDs from a configuration file.

🔄 Data Synchronization

To maintain consistency between loose-coupled microservices, I implemented an event-based sync mechanism:

  • User Sync: When an Admin creates a User in the User Service, a message is published. The Device Service consumes this to map future devices to that user.
  • Device Sync: When a Device is created, a message is published so the Monitoring Service knows to expect data for that device ID.

📊 Frontend Upgrades (Angular)

The Client interface now includes specific visualization tools:

  • Historical Data: Clients can select a date from a calendar.
  • Visualization: Displays energy consumption charts (Bar/Line graphs) with:
    • X-Axis: Hours of the day.
    • Y-Axis: Energy value (kWh).

🛠️ Tech Stack

  • Backend: Java Spring Boot (Microservices)
  • Middleware: RabbitMQ (AMQP Protocol)
  • Frontend: Angular (with Chart.js / ng2-charts)
  • Database: PostgreSQL / MySQL (Per-service database pattern)
  • DevOps: Docker, Docker Compose, Traefik

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages