This Java-based project enables real-time communication between multiple publishers and subscribers using a network of Brokers to handle message routing with flexibility and efficiency.
- Decoupled Architecture
The system decouples publishers and subscribers through a network of Brokers, allowing for asynchronous communication and reducing direct dependencies between components. - Multi-Broker Synchronization
Brokers communicate with each other to ensure message consistency across the network, so subscribers can always receive relevant messages, regardless of which Broker they're connected to. - Fault Tolerance & Scalability
Fault-tolerant mechanisms are in place to handle disconnections of publishers or subscribers, automatically removing related topics and subscriptions to maintain system consistency. Additionally, using a thread-per-client model ensures that each connection is handled independently, enhancing scalability. - TCP Socket Communication
The system uses TCP sockets for reliable, connection-oriented communication between publishers, subscribers, and brokers. This design choice ensures that messages are reliably delivered and that real-time updates are consistently synchronized across all brokers.
- Create Topics
- Publish Messages
- Show Subscriber Count
- Delete Topics
- List Topics
- Subscribe to Topics
- Receive Real-Time Messages
- Unsubscribe from Topics
Make sure you have JDK 21.0.3 installed. Then, follow these steps:
-
Download the following files and place them in a folder:
broker.jarpublisher.jarsubscriber.jar
-
Navigate to the folder in your terminal:
cd /path/to/your/folder -
Start the Broker by specifying the port:
java -jar broker.jar <port>
-
Start the Publisher and connect it to a Broker:
java -jar publisher.jar <broker-ip> <broker-port>
-
Start the Subscriber and connect it to a Broker:
java -jar subscriber.jar <broker-ip> <broker-port>
Feel free to reach out with any questions or feedback.π