RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Classes | Public Member Functions | Public Attributes
Datacratic::EndpointConnector Struct Reference

#include <zmq_named_pub_sub.h>

Inheritance diagram for Datacratic::EndpointConnector:
Datacratic::MessageLoop Datacratic::Epoller Datacratic::AsyncEventSource

List of all members.

Classes

struct  Entry

Public Member Functions

void init (std::shared_ptr< ConfigurationService > config)
void watchEndpoint (const std::string &endpointPath)
void unwatchEndpoint (const std::string &endpoint, bool forceDisconnect)
virtual bool connect (const std::string &endpointPath, const std::string &entryName, const Json::Value &params)
void handleDisconnection (const std::string &endpointPath, const std::string &entryName)

Public Attributes

std::function< bool(const
std::string &endpointPath,
const std::string &entry,
const Json::Value &params)> 
connectHandler

Detailed Description

This class keeps track of watching and connecting to a particular endpoint.

Specifically, an endpoint is in the configuration service under the path

/serviceName/endpoint

It can have one or more entries under that path for different versions of the endpoint:

/serviceName/endpoint/tcp /serviceName/endpoint/ipc /serviceName/endpoint/shm

etc.

This class will: 1. If there are no entries under the endpoint, then it will wait until one or more appear in the object. 2. Once there is one or more endpoints, it will attempt to connect to each of them until it finds one that works. 3. If there is a disconnection from an endpoint, it will attempt to re-establish a connection. 4. If the configuration string of an endpoint changes, it will attempt a re-connection.

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 173 of file zmq_named_pub_sub.h.


Member Function Documentation

virtual bool Datacratic::EndpointConnector::connect ( const std::string &  endpointPath,
const std::string &  entryName,
const Json::Value params 
) [inline, virtual]

This method will be called when a connection is needed to a service. It should call the onDone function with a boolean indicating whether or not a connection was established.

Return code: false = connection failed true = connection succeeded

TODO: make this work with asynchronous connections

Definition at line 250 of file zmq_named_pub_sub.h.

void Datacratic::EndpointConnector::handleDisconnection ( const std::string &  endpointPath,
const std::string &  entryName 
) [inline]

Method to be called back when there is a disconnection.

Definition at line 260 of file zmq_named_pub_sub.h.

void Datacratic::EndpointConnector::unwatchEndpoint ( const std::string &  endpoint,
bool  forceDisconnect 
) [inline]

Stop watching the given endpoint, which should have already been watched via watchEndpoint.

Definition at line 230 of file zmq_named_pub_sub.h.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator