What it does
Distributed publish-subscribe alert broadcasting system built on the STOMP protocol: a Java 8 server (switchable between a thread-per-client model and a non-blocking reactor/NIO model) paired with a C++11 command-line client (Boost ASIO) for real-time channel subscription and event broadcast.
How it works
The server speaks STOMP over TCP. Clients send CONNECT, SUBSCRIBE, UNSUBSCRIBE, SEND, and DISCONNECT; the server answers with CONNECTED, MESSAGE, RECEIPT, and ERROR.
The same protocol logic runs under two selectable threading models. Thread-per-client gives every connection its own OS thread. Reactor mode runs a single non-blocking NIO selector that hands work to an actor thread pool.
Channels are the unit of subscription. When one client sends an event to a channel, every other client subscribed to that channel receives a MESSAGE frame for it; the sender gets a RECEIPT.
The C++11 client is a command-line program built on Boost ASIO. It offers login, join, exit, report, summary, and logout, and reads the events it publishes from a JSON file.
Design decisions
- 01Two selectable server threading models: thread-per-client (one OS thread per connection) and reactor (a non-blocking NIO selector with an actor thread pool).
- 02Supported frames: CONNECT, SUBSCRIBE, UNSUBSCRIBE, SEND, DISCONNECT from clients; CONNECTED, MESSAGE, RECEIPT, ERROR from the server.
- 03The C++ client offers login, join, exit, report, summary, and logout commands, and reads events to publish from a JSON file.
- 04Subscribers on a channel receive MESSAGE frames for events other clients send to it.
Stack
- Server language
- Java 8
- Protocol
- STOMP
- Concurrency
- Thread-per-client; Java NIO selector (reactor mode)
- Client language
- C++11
- Client libraries
- Boost ASIO, Boost Thread
- Build
- Maven (server), Make (client)