RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
core/post_auction/post_auction_runner.cc
00001 /* post_auction_runner.cc
00002    Wolfgang Sourdeau, March 2013
00003 
00004    Copyright (c) 2013 Datacratic Inc.  All rights reserved.
00005 */
00006 
00007 #include <boost/program_options/options_description.hpp>
00008 #include <boost/program_options/parsers.hpp>
00009 #include <boost/program_options/variables_map.hpp>
00010 
00011 #include "rtbkit/core/banker/slave_banker.h"
00012 #include "soa/service/service_utils.h"
00013 
00014 #include "post_auction_loop.h"
00015 
00016 using namespace std;
00017 using namespace boost::program_options;
00018 using namespace Datacratic;
00019 using namespace RTBKIT;
00020 
00021 
00022 int main(int argc, char ** argv)
00023 {
00024     ServiceProxyArguments proxyArgs;
00025 
00026     options_description all_opt;
00027     all_opt.add(proxyArgs.makeProgramOptions());
00028     all_opt.add_options()
00029         ("help,h", "print this message");
00030     
00031     variables_map vm;
00032     store(command_line_parser(argc, argv)
00033           .options(all_opt)
00034           .run(),
00035           vm);
00036     notify(vm);
00037 
00038     if (vm.count("help")) {
00039         cerr << all_opt << endl;
00040         exit(1);
00041     }
00042 
00043     shared_ptr<ServiceProxies> proxies = proxyArgs.makeServiceProxies();
00044 
00045     // First start up the post auction loop
00046     PostAuctionLoop service(proxies, "postAuction");
00047 
00048     auto banker = make_shared<SlaveBanker>(proxies->zmqContext,
00049                                            proxies->config,
00050                                            service.serviceName()
00051                                            + ".slaveBanker");
00052     banker->start();
00053 
00054     service.init();
00055     service.setBanker(banker);
00056     service.bindTcp();
00057     service.start();
00058 
00059     proxies->config->dump(cerr);
00060 
00061     for (;;) {
00062         ML::sleep(10.0);
00063     }
00064 }
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator