How floholzer/elektrolade works
Project Type and Primary Purpose
• This is a distributed full-stack system designed for generating invoices for customers of electric charging stations.
• It uses a mix of technologies: Java Spring Boot for REST-APIs, JavaFX for the UI, and RabbitMQ for inter-service communication.
• The system incorporates several microservices and Dockerized databases, which together implement a workflow from UI request to invoice PDF generation.
Main Components
a. User Interface:
• JavaFX-based UI (StationUI) that accepts customer IDs and displays/downloads generated PDF invoices.
b. REST API:
• StationAPI – a Spring Boot-based service that processes HTTP requests initiated by the UI.
c. Message Queue:
• RabbitMQ – responsible for coordinating communication among services via various queues (e.g., start_queue, stations_info_queue, job_notify_queue, station_data_queue, pdf_data_queue).
d. Microservices:
• DataCollectionDispatcher: Handles incoming data collection tasks and directs data dispatch.
• DataCollectionReceiver: Receives and processes data sent from various collection points.
• PDFgenerator: Processes invoice data and generates PDF files.
• StationDataCollector: Collects data from individual station databases.
e. Databases (all deployed via Docker):
• Customer Database – contains customer details.
• Stations Database – holds overall station information.
• Individual Station Databases (three separate databases) – contain detailed customer station data.
Relationships and Interactions
• The UI sends an HTTP request to the StationAPI when a user initiates an invoice generation, which then triggers a chain of events:
• StationAPI communicates with the message broker (RabbitMQ) by publishing messages to the appropriate queues.
• The DataCollectionDispatcher picks up messages from the queue, organizes and dispatches data gathering jobs.
• The StationDataCollector reaches out to individual station databases to fetch necessary data.
• DataCollectionReceiver processes incoming data and consolidates it.
• Once data is ready, the PDFgenerator receives the message (through a designated queue) and creates the PDF invoice.
• The UI is then notified (or polls) to download the generated invoice from the file system.
Architectural Patterns and Design Principles
• Microservices Architecture: Each service (API, UI, data collectors, PDF generator) is modular and deployed independently, enabling scalability.
• Message-Driven Communication: Use of RabbitMQ illustrates asynchronous communication between microservices.
• Containerization: The use of Docker for the databases infers a containerized deployment approach.
• Separation of Concerns: The division between UI, API, data collection, and PDF generation underlines a clear separation of responsibilities.
Relevant Technologies and Frameworks
• Spring Boot for REST API development.
• JavaFX for the frontend user interface.
• RabbitMQ for the messaging queue mechanism.
• Maven for build and dependency management (as seen in multiple Maven wrapper files).
• Docker (and docker-compose) for orchestrating database containers.
Final Assembly
• Drill down to detail internal interactions among the backend microservices.
• Asynchronous design; illustrate that while the REST API responds immediately, the data processing is handled asynchronously by various dispatcher and receiver services.