RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
testing/mock_exchange_runner.cc
00001 /* mock_exchange_runner.cc
00002    Eric Robert, March 2013
00003    Copyright (c) 2013 Datacratic.  All rights reserved.
00004 
00005    Mock exchange runner
00006 */
00007 
00008 #include "soa/service/service_utils.h"
00009 #include "mock_exchange.h"
00010 
00011 #include <boost/program_options/parsers.hpp>
00012 #include <boost/program_options/variables_map.hpp>
00013 #include <boost/make_shared.hpp>
00014 
00015 using namespace std;
00016 using namespace Datacratic;
00017 
00018 int main(int argc, char ** argv)
00019 {
00020     using namespace boost::program_options;
00021 
00022     std::vector<int> bidPort = { 12339 };
00023     std::vector<int> winPort = { 12340 };
00024     int thread = 1;
00025 
00026     ServiceProxyArguments args;
00027     options_description options = args.makeProgramOptions();
00028     options_description more("Mock Exchange");
00029     more.add_options()
00030         ("bid-port,b", value(&bidPort), "outgoing port for bids")
00031         ("win-port,w", value(&winPort), "outgoing port for wins")
00032         ("thread,t", value(&thread), "number of worker thread");
00033 
00034     options.add(more);
00035     options.add_options() ("help,h", "Print this message");
00036 
00037     variables_map vm;
00038     store(command_line_parser(argc, argv) .options(options) .run(), vm);
00039     notify(vm);
00040 
00041     if (vm.count("help")) {
00042         cerr << options << endl;
00043         exit(1);
00044     }
00045 
00046     RTBKIT::MockExchange exchange(args);
00047     exchange.start(thread, 0, bidPort, winPort);
00048 
00049     for(;;) {
00050         this_thread::sleep_for(chrono::seconds(10));
00051     }
00052 
00053     return 0;
00054 }
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator