ZeroEQ
0.9.0
ZeroEQ - Zero Event Queue
|
To enable an application to republish all its state when a new subscriber connected, we need a way to monitor connection requests. This RFC describes this feature for this use case, based on zmq_socket_monitor.
class Sender { virtual void* getSocket() = 0; }; class Publisher : public Sender {}; class Monitor : public Receiver { Monitor( Sender& sender ); Monitor( Sender& sender, Receiver& shared ); virtual void notifyNewConnection() {} // other notifies and params lazy, on use case };
Livre Communicator derives from Monitor and republishes all events on notify.
Change zeroeq::Publisher socket to ZMQ_XPUB to receive topic subscriptions. Follow the Meerkat pattern to count subscribers.
Monitor installs zmq_socket_monitor() on Sender::getSocket(). Monitor::process() calls Monitor::notifyNewConnection().
Resolution: Use Meerkat pattern. The initial implementation showed that pub/sub sockets do not support notifications. The Meerkat pattern explains the proper way to do this.