![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <rest_proxy.h>
Classes | |
| struct | Operation |
Public Types | |
|
typedef std::function< void(std::exception_ptr, int responseCode, const std::string &)> | OnDone |
Public Member Functions | |
| RestProxy (const std::shared_ptr< zmq::context_t > &context) | |
| void | sleepUntilIdle () |
| void | shutdown () |
| void | init (std::shared_ptr< ConfigurationService > config, const std::string &serviceName) |
| void | initServiceClass (std::shared_ptr< ConfigurationService > config, const std::string &serviceClass, const std::string &endpointName) |
| void | push (const RestRequest &request, const OnDone &onDone) |
| void | push (const OnDone &onDone, const std::string &method, const std::string &resource, const RestParams ¶ms=RestParams(), const std::string &payload="") |
| size_t | numMessagesOutstanding () const |
Protected Member Functions | |
| void | handleOperation (const Operation &op) |
| void | handleZmqResponse (const std::vector< std::string > &message) |
Protected Attributes | |
| std::string | serviceName_ |
| TypedMessageSink< Operation > | operationQueue |
| ZmqNamedProxy | connection |
| std::map< uint64_t, OnDone > | outstanding |
| int | numMessagesOutstanding_ |
| uint64_t | currentOpId |
Proxy that handles a set of outstanding asynchronous operations to a rest endpoint and deals with getting the results back.
Definition at line 81 of file rest_proxy.h.
| void Datacratic::RestProxy::init | ( | std::shared_ptr< ConfigurationService > | config, |
| const std::string & | serviceName | ||
| ) |
Initialize and connect to the given service on the "zeromq" endpoint.
Reimplemented in RTBKIT::SlaveBudgetController.
Definition at line 74 of file rest_proxy.cc.
| void Datacratic::RestProxy::initServiceClass | ( | std::shared_ptr< ConfigurationService > | config, |
| const std::string & | serviceClass, | ||
| const std::string & | endpointName | ||
| ) |
Initialize and connect to an instance of the given service class.
Definition at line 95 of file rest_proxy.cc.
| void Datacratic::RestProxy::push | ( | const RestRequest & | request, |
| const OnDone & | onDone | ||
| ) |
Push the given request to be performed. When the result comes back, it will be passed to OnDone.
Definition at line 115 of file rest_proxy.cc.
| void Datacratic::RestProxy::push | ( | const OnDone & | onDone, |
| const std::string & | method, | ||
| const std::string & | resource, | ||
| const RestParams & | params = RestParams(), |
||
| const std::string & | payload = "" |
||
| ) |
Push the given request to be performed.
Definition at line 128 of file rest_proxy.cc.
1.7.6.1