Publish Subscribe System using ZMQ
$ ./main.py
pstickle
consists of 5 components (drops) as shown in the following figure:
Messages are passed around using an intermediary proxy
. It implements
ZMQ XPUB
and XSUB
sockets which can be connected from publishers and
subscribers. First, all subscribers send their respective subscriptions
to the proxy. Proxy then, relays all the subscriptions to all the
publishers. Publishers filter messages based on the received subscription
and forwards them to correct subscribers through the proxy. Here, proxy
allows us to dynamically add and remove publishers and subsribers to/form
the system.
Following figure shows the flow of messages in the system:
Simply modify main.py
and add more drops using the Drop
class.
main.py
only runs on localhost- Doesn't stop cleanly on
ctrl+c
- Subscribers do not receive messages until the subscription has been completely processed by the publishers which can result in loss of messages