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

#include <zmq_endpoint.h>

Inheritance diagram for Datacratic::ZmqSocketMonitor:
Datacratic::ZmqBinaryTypedEventSource< zmq_event_t > Datacratic::AsyncEventSource

List of all members.

Public Types

typedef std::function< void(std::string,
int, zmq_event_t)> 
EventHandler

Public Member Functions

 ZmqSocketMonitor (zmq::context_t &context)
void shutdown ()
void init (zmq::socket_t &socketToMonitor, int events=ZMQ_EVENT_ALL)
virtual int handleEvent (const zmq_event_t &event)

Public Attributes

EventHandler connectHandler
EventHandler bindHandler
EventHandler acceptHandler
EventHandler closeHandler
EventHandler disconnectHandler
EventHandler connectFailureHandler
EventHandler acceptFailureHandler
EventHandler bindFailureHandler
EventHandler closeFailureHandler
EventHandler connectRetryHandler
EventHandler defaultHandler

Detailed Description

This class allows a zeromq socket to be monitored and events received on various events.

It is an AsyncEventHandler which must be integrated into a message queue. The events will be delivered when processed by the message queue.

Definition at line 380 of file zmq_endpoint.h.


Member Typedef Documentation

typedef std::function<void (std::string, int, zmq_event_t)> Datacratic::ZmqSocketMonitor::EventHandler

Event handler for events:

  • The first argument is the address which the event concerns;
  • The second argument is
    • In the case of a success message or an event message, the fd which was created to deal with the socket or the fd on which the event occurred
    • In the case of a failure message, the errno for the failed operation
    • In the case of a retry message, the time (in milliseconds) when the operation will be retried.

Definition at line 410 of file zmq_endpoint.h.


Member Function Documentation

int Datacratic::ZmqSocketMonitor::handleEvent ( const zmq_event_t &  event) [virtual]

Function called to handle an event. Default implementation looks at the event type and dispatches to one of the xxxHandler variables above, or defaultHandler if it's empty.

This can be overriden to modify the behaviour.

Definition at line 203 of file zmq_endpoint.cc.

void Datacratic::ZmqSocketMonitor::init ( zmq::socket_t socketToMonitor,
int  events = ZMQ_EVENT_ALL 
)

Initialize the socket monitor to monitor the given socket.

The events parameter is an event mask; see http://api.zeromq.org/3-2:zmq-socket-monitor for details of what it means.

Definition at line 170 of file zmq_endpoint.cc.


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