![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <generic_exchange_connector.h>
Public Member Functions | |
GenericExchangeConnector (ServiceBase &owner, Json::Value config) | |
virtual void | shutdown () |
virtual std::string | exchangeName () const |
virtual std::shared_ptr < RTBKIT::BidRequest > | parseBidRequest (HttpAuctionHandler &connection, const HttpHeader &header, const std::string &payload) |
virtual double | getTimeAvailableMs (HttpAuctionHandler &connection, const HttpHeader &header, const std::string &payload) |
virtual double | getRoundTripTimeMs (HttpAuctionHandler &connection, const HttpHeader &header) |
virtual HttpResponse | getResponse (const HttpAuctionHandler &connection, const HttpHeader &requestHeader, const RTBKIT::Auction &auction) const |
virtual HttpResponse | getDroppedAuctionResponse (const HttpAuctionHandler &connection, const RTBKIT::Auction &auction, const std::string &reason) const |
virtual HttpResponse | getErrorResponse (const HttpAuctionHandler &connection, const RTBKIT::Auction &auction, const std::string &errorMessage) const |
Public Attributes | |
int | numThreads |
Configuration parameters. | |
int | listenPort |
std::string | bindHost |
bool | performNameLookup |
int | backlog |
Exchange connector that takes bid requests in our generic bid request format over HTTP.
Definition at line 24 of file generic_exchange_connector.h.
virtual std::string RTBKIT::GenericExchangeConnector::exchangeName | ( | ) | const [inline, virtual] |
Return the name of the exchange, as it would be written as an identifier.
Implements RTBKIT::HttpExchangeConnector.
Definition at line 40 of file generic_exchange_connector.h.
HttpResponse RTBKIT::GenericExchangeConnector::getDroppedAuctionResponse | ( | const HttpAuctionHandler & | connection, |
const RTBKIT::Auction & | auction, | ||
const std::string & | reason | ||
) | const [virtual] |
Return a stringified JSON of the response for when we drop an auction.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 168 of file generic_exchange_connector.cc.
HttpResponse RTBKIT::GenericExchangeConnector::getErrorResponse | ( | const HttpAuctionHandler & | connection, |
const RTBKIT::Auction & | auction, | ||
const std::string & | errorMessage | ||
) | const [virtual] |
Return a stringified JSON of the 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 182 of file generic_exchange_connector.cc.
HttpResponse RTBKIT::GenericExchangeConnector::getResponse | ( | const HttpAuctionHandler & | connection, |
const HttpHeader & | requestHeader, | ||
const RTBKIT::Auction & | auction | ||
) | const [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 101 of file generic_exchange_connector.cc.
double RTBKIT::GenericExchangeConnector::getRoundTripTimeMs | ( | HttpAuctionHandler & | connection, |
const HttpHeader & | header | ||
) | [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 93 of file generic_exchange_connector.cc.
double RTBKIT::GenericExchangeConnector::getTimeAvailableMs | ( | HttpAuctionHandler & | connection, |
const HttpHeader & | header, | ||
const std::string & | payload | ||
) | [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 65 of file generic_exchange_connector.cc.
std::shared_ptr< BidRequest > RTBKIT::GenericExchangeConnector::parseBidRequest | ( | HttpAuctionHandler & | connection, |
const HttpHeader & | header, | ||
const std::string & | payload | ||
) | [virtual] |
Parse the given payload into a bid request.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 49 of file generic_exchange_connector.cc.
void RTBKIT::GenericExchangeConnector::shutdown | ( | ) | [virtual] |
Shutdown the exchange connector ready to be destroyed.
Reimplemented from RTBKIT::HttpExchangeConnector.
Definition at line 41 of file generic_exchange_connector.cc.