
Vertx + Hazelcast + Datastar
This project implements a real-time heat sensor monitoring system using Vert.x and Hazelcast for distributed, clustered communication. The system operates a 3-node cluster that uses the Vert.x clustered event bus for inter-node communication. It provides a reactive and live UI to display heat sensor data and allows dynamic deployment and undeployment of sensors. The Datastar library is used to handle Server-Sent Events (SSE) and to facilitate the reactive user interface.
Key Features
Clustered Architecture
- A 3-node Vert.x cluster is formed using Hazelcast as the clustering manager.
- Nodes communicate using the Vert.x clustered event bus, ensuring scalability and resilience.
Heat Sensor Data Collection
- Each node can deploy virtual heat sensors.
- Sensors emit temperature data, which is shared across the cluster via the event bus.
Real-Time Live Updates
- Provides a reactive and real-time UI for monitoring sensor data.
- Utilizes Server-Sent Events (SSE) via the Datastar library to stream live heat sensor updates to the frontend.
Dynamic Sensor Deployment
- Sensors can be deployed or undeployed dynamically in response to user actions or system triggers.
- Deployment updates are shared across the cluster in real time.
Reactive UI
- The UI, powered by Datastar, provides a seamless and interactive experience for viewing heat sensor data and managing the system.
Technology Stack
Vert.x
- Framework for reactive, asynchronous event-driven applications.
- Provides the clustered event bus for inter-node communication.
Hazelcast
- Used for clustering and distributed data sharing between the nodes.
Datastar
- Library for handling Server-Sent Events (SSE) to deliver real-time updates.
- Enables a fully reactive UI for live monitoring and system control.
Server-Sent Events (SSE)
- Efficient one-way streaming of live sensor data to the frontend.
System Workflow
Cluster Initialization
- The Vert.x application is deployed on a 3-node cluster managed by Hazelcast.
- Each node is connected to the Vert.x clustered event bus for communication.
Heat Sensor Deployment
- Sensors are dynamically deployed or undeployed on any cluster node.
- Deployment and undeployment events are propagated to all nodes via the event bus.
Data Collection and Propagation
- Sensors emit heat data asynchronously.
- Data is published to the clustered event bus and consumed by all nodes.
Real-Time Streaming
- A backend endpoint streams the data to the frontend using Datastar for SSE.
- The UI reacts to updates in real time, ensuring users see live sensor data.
Reactive Controls
- Users can deploy or undeploy sensors via the reactive UI.
- The system processes these actions immediately, updating the cluster state.
Deployment
- The system is deployed using Docker Compose, enabling simple multi-container orchestration.
- Each cluster node runs as an independent Docker container, communicating over a Hazelcast network using a bridge network defined in the
docker-compose.yml.