RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <zmq_named_pub_sub.h>
Classes | |
struct | ServiceClassEntry |
struct | WatchEntry |
Public Types | |
typedef std::function< void(std::string path, bool)> | ChangeHandler |
Public Member Functions | |
void | init (std::shared_ptr< ConfigurationService > config) |
uint64_t | watchServiceClass (const std::string &serviceClass, ChangeHandler onChange) |
void | unwatchServiceClass (const std::string &serviceClass, uint64_t token) |
Public Attributes | |
ChangeHandler | changeHandler |
This class keeps track of watching for service providers and making sure that there is a connection to each of them.
It performs the following actions: Watches the configuration node for a given service class If a new service provider appears, calls a connect callback If a service provider disappears, calls a disconnect callback
It is designed to integrate into an existing message loop so that the notifications will be processed in the same thread as the other messages and locking is not required.
Definition at line 786 of file zmq_named_pub_sub.h.
typedef std::function<void (std::string path, bool)> Datacratic::ServiceProviderWatcher::ChangeHandler |
Type of a function that will be called when there is a change on the service providers.
Definition at line 816 of file zmq_named_pub_sub.h.
void Datacratic::ServiceProviderWatcher::unwatchServiceClass | ( | const std::string & | serviceClass, |
uint64_t | token | ||
) | [inline] |
Stop watching the given service class.
Definition at line 864 of file zmq_named_pub_sub.h.
uint64_t Datacratic::ServiceProviderWatcher::watchServiceClass | ( | const std::string & | serviceClass, |
ChangeHandler | onChange | ||
) | [inline] |
Notify whenever an instance of the given service class goes down or up.
Whenever there is a change, the onChange handler will be called from within the owning message loop.
Returns a token that can be used to unregister the watch.
Definition at line 827 of file zmq_named_pub_sub.h.