In a Pub/Sub architecture, there are message Publishers and Subscribers. A special type of middleware amalgamates the Publishers and Subscribers in an Asynchronous mode of communication. The messages among the participants could be grouped based on unique topics, where a publisher may publish on one or many topics, and a subscriber may also listen to one or many topics.
The system allows multiple publishers and subscribers to communicate asynchronously through topic-based message distribution.
To improve availability, the system extended into a multi-server failover architecture. Instead of relying on a single server, multiple server instances (brokers) are run on different ports. The client maintains a list of available servers and attempts to connect to the primary server. If the primary server fails, the client automatically reconnects to a backup server.
This approach reduces downtime and eliminates the single point of failure in the system. This is a simplified implementation to distributed messaging systems, it effectively failover handling and improved system availability.
Run multiple servers;
python server.py 5000
python server.py 5001
python server.py 5002
python client.py PUBLISHER SPORTS
python client.py SUBSCRIBER SPORTS
python client.py SUBSCRIBER BLOG
When One server dies, clients reconnects automatically to a another server. The system will works without any interruption.
This implementation improves availability, but not full message reliability, because brokers do not replicate messages to each other.
