All projectsNetworking · Concurrency

Emergency-Alert-System.

JavaSTOMPJava NIOC++11Boost ASIO
01

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.

02

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.

03

Design decisions

  1. 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).
  2. 02Supported frames: CONNECT, SUBSCRIBE, UNSUBSCRIBE, SEND, DISCONNECT from clients; CONNECTED, MESSAGE, RECEIPT, ERROR from the server.
  3. 03The C++ client offers login, join, exit, report, summary, and logout commands, and reads events to publish from a JSON file.
  4. 04Subscribers on a channel receive MESSAGE frames for events other clients send to it.
04

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)
05

Source

More work

See the other systems, or say hello.