pubsub is a client-server application developed in Java that enables multiple clients to connect to a server and communicate through topic-based messaging. The project leverages socket programming and multithreading to ensure concurrent message handling.
- Topic-based messaging: Clients can register to topics as either publishers or subscribers.
- Multithreaded architecture: The server can handle multiple clients concurrently.
- Thread synchronization: Utilizes synchronized blocks and concurrent collections to prevent race conditions.
- Backlog System: Stores client commands during server inspection mode and executes them once the mode ends.
- Extended Server Commands:
kick <clientID>: Removes a client from the server.export <clientID|topicID>: Saves messages to a file.users: Lists all connected users.clear: Deletes all messages in an inspected topic.
- Java (Sockets, Threads, Concurrency API)
- ConcurrentHashMap, ConcurrentLinkedQueue
- ExecutorService for thread management
- Java JDK 8+
javac Server.java Client.java ClientHandler.java Message.javajava Server <portNumber><portNumber>should be in the range 1024-65535.
java Client <serverIP> <portNumber>- Replace
<serverIP>withlocalhostfor local testing or the actual server IP.
help: Displays available commandspublish <topic>: Registers as a publisher for a topicsubscribe <topic>: Registers as a subscribersend <message>: Sends a message to the topiclist: Displays messages sent by the publisherlistall: Displays all messages in the topicquit: Disconnects from the server
show: Lists all topicsinspect <topic>: Starts inspecting a topicend: Ends topic inspectionlistall: Displays all messages in a topic (during inspect mode)delete <messageID>: Removes a specific message (during inspect mode)kick <clientID>: Disconnects a clientclear: Clears all messages from an inspected topicexport <clientID|topicID>: Saves messages to a log fileusers: Displays all connected clients
- Edoardo Galli (0001049383) - [email protected]
- Jean Baptiste Dindane (0001100694)
This project is licensed under the MIT License - see the LICENSE file for details.
For more details on the architecture and implementation, refer to LABSO_DOCUMENTAZIONE.pdf in the docs/ directory.