![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
Public Member Functions | |
MockExchangeConnector (ServiceBase &owner, const std::string &name) | |
MockExchangeConnector (const std::string &name, std::shared_ptr< ServiceProxies > proxies) | |
std::string | exchangeName () const |
void | configure (Json::Value const ¶meters) |
void | start () |
std::shared_ptr< BidRequest > | parseBidRequest (HttpAuctionHandler &handler, Datacratic::HttpHeader const &header, std::string const &payload) |
double | getTimeAvailableMs (HttpAuctionHandler &handler, const HttpHeader &header, const std::string &payload) |
double | getRoundTripTimeMs (HttpAuctionHandler &handler, const HttpHeader &header) |
Datacratic::HttpResponse | getResponse (HttpAuctionHandler const &handler, const HttpHeader &header, Auction const &auction) const |
Public Attributes | |
int | numThreads |
Configuration parameters. | |
int | listenPort |
std::string | bindHost |
bool | performNameLookup |
int | backlog |
Definition at line 14 of file mock_exchange_connector.h.
void RTBKIT::MockExchangeConnector::configure | ( | Json::Value const & | parameters | ) | [inline, virtual] |
Configure the exchange connector. The JSON provided is entirely interpreted by the exchange connector itself.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 33 of file mock_exchange_connector.h.
std::string RTBKIT::MockExchangeConnector::exchangeName | ( | ) | const [inline, virtual] |
Return the name of the exchange, as it would be written as an identifier.
Implements RTBKIT::HttpExchangeConnector.
Definition at line 29 of file mock_exchange_connector.h.
Datacratic::HttpResponse RTBKIT::MockExchangeConnector::getResponse | ( | HttpAuctionHandler const & | connection, |
const HttpHeader & | requestHeader, | ||
Auction const & | auction | ||
) | const [inline, virtual] |
Return the HTTP response for our auction. Default implementation calls getResponse() and stringifies the result.
This version is provided as it may be more efficient in terms of memory allocations.
The first element returned is the HTTP body, the second is the content type.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 70 of file mock_exchange_connector.h.
double RTBKIT::MockExchangeConnector::getRoundTripTimeMs | ( | HttpAuctionHandler & | connection, |
const HttpHeader & | header | ||
) | [inline, virtual] |
Return an estimate of how long a round trip with the connected server takes, in milliseconds at the exchange's latency percentile, including all hops (load balancers, reverse proxies, etc).
The default implementation returns 5ms, which is only valid for when a service is in the same datacenter. Many exchanges implement as part of their protocol a way to measure the round trip time between a given exchange host and a given bidder.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 65 of file mock_exchange_connector.h.
double RTBKIT::MockExchangeConnector::getTimeAvailableMs | ( | HttpAuctionHandler & | connection, |
const HttpHeader & | header, | ||
const std::string & | payload | ||
) | [inline, virtual] |
Return the available time for the bid request in milliseconds. This method should not parse the bid request, as when shedding load we want to do as little work as possible.
Most exchanges include this information in the HTTP headers.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 59 of file mock_exchange_connector.h.
std::shared_ptr<BidRequest> RTBKIT::MockExchangeConnector::parseBidRequest | ( | HttpAuctionHandler & | connection, |
Datacratic::HttpHeader const & | header, | ||
std::string const & | payload | ||
) | [inline, virtual] |
Parse the given payload into a bid request.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 51 of file mock_exchange_connector.h.
void RTBKIT::MockExchangeConnector::start | ( | ) | [inline, virtual] |
Start the exchange connector running
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 47 of file mock_exchange_connector.h.