![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <zmq_named_pub_sub.h>
Public Types | |
enum | ConnectionState { NO_CONNECTION, CONNECTING, CONNECTED, DISCONNECTED } |
typedef std::function< void(std::vector < zmq::message_t > &&)> | MessageHandler |
Public Member Functions | |
ZmqNamedSocket (zmq::context_t &context, int type) | |
void | init (std::shared_ptr< ConfigurationService > config) |
void | shutdown () |
void | connectToEndpoint (const std::string &endpointPath) |
void | disconnect () |
Disconnect from the connected endpoint. | |
std::string | getConnectedEndpoint () const |
Endpoint we're configured to connect to. | |
std::string | getConnectedAddress () const |
Address we're currently connecting/connected to. | |
ConnectionState | getConnectionState () const |
Current state of the connection. | |
virtual void | handleMessage (std::vector< zmq::message_t > &&message) |
template<typename Fn > | |
void | performSocketOpSync (Fn fn) |
void | sendSync (std::vector< zmq::message_t > &&message) |
Public Attributes | |
MessageHandler | messageHandler |
Active socket that attempts to connect into an endpoint.
Definition at line 396 of file zmq_named_pub_sub.h.
typedef std::function<void (std::vector<zmq::message_t> &&)> Datacratic::ZmqNamedSocket::MessageHandler |
Callback that will be called when a message is received if handlerMessage is not overridden.
Definition at line 525 of file zmq_named_pub_sub.h.
NO_CONNECTION |
No connection was requested. |
CONNECTING |
Connection is attempting to connect. |
CONNECTED |
Connection is connected. |
DISCONNECTED |
Connection was connected but has disconnected. |
Definition at line 398 of file zmq_named_pub_sub.h.
virtual void Datacratic::ZmqNamedSocket::handleMessage | ( | std::vector< zmq::message_t > && | message | ) | [inline, virtual] |
Function called when a message is received on the socket. Default action is to call messageHandler. Can be overridden or messageHandler can be assigned to.
Definition at line 532 of file zmq_named_pub_sub.h.
void Datacratic::ZmqNamedSocket::init | ( | std::shared_ptr< ConfigurationService > | config | ) | [inline] |
Initialization. Can only be called once and is not protected from multiple threads.
Definition at line 423 of file zmq_named_pub_sub.h.
void Datacratic::ZmqNamedSocket::performSocketOpSync | ( | Fn | fn | ) | [inline] |
Call the given function synchronously with locking set up such that no other socket operation can occur at the same time. This allows for socket operations to be performed from any thread. Note that the operation must not call any methods on this object or a locking error will occur.
Function signature must match
void fn(zmq::socket_t &)
Definition at line 554 of file zmq_named_pub_sub.h.
void Datacratic::ZmqNamedSocket::sendSync | ( | std::vector< zmq::message_t > && | message | ) | [inline] |
Send the given message synchronously.
Definition at line 561 of file zmq_named_pub_sub.h.