RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
soa/service/service_dump.cc
00001 /* banker_service_runner.cc                                        -*- C++ -*-
00002    Jeremy Barnes, 20 November 2012
00003    Copyright (c) 2012 Datacratic.  All rights reserved.
00004 
00005    Runner for the banker service.
00006 */
00007 
00008 
00009 #include <boost/program_options/cmdline.hpp>
00010 #include <boost/program_options/options_description.hpp>
00011 #include <boost/program_options/positional_options.hpp>
00012 #include <boost/program_options/parsers.hpp>
00013 #include <boost/program_options/variables_map.hpp>
00014 #include <boost/algorithm/string.hpp>
00015 #include <boost/thread/thread.hpp>
00016 #include <boost/make_shared.hpp>
00017 
00018 #include "service_base.h"
00019 
00020 
00021 using namespace std;
00022 using namespace Datacratic;
00023 
00024 
00025 int main(int argc, char ** argv)
00026 {
00027     using namespace boost::program_options;
00028 
00029     options_description configuration_options("Configuration options");
00030 
00031     std::string zookeeperUri("localhost:2181");
00032     std::string installation;
00033 
00034     std::vector<std::string> carbonUris;  
00035     std::vector<std::string> fixedHttpBindAddresses;
00036 
00037     configuration_options.add_options()
00038         ("zookeeper-uri,Z", value(&zookeeperUri),
00039          "URI of zookeeper to use (localhost:2181)")
00040         ("installation,I", value(&installation),
00041          "Name of the installation that is running");
00042 
00043     options_description all_opt;
00044     all_opt
00045         .add(configuration_options);
00046     all_opt.add_options()
00047         ("help,h", "print this message");
00048     
00049     variables_map vm;
00050     store(command_line_parser(argc, argv)
00051           .options(all_opt)
00052           //.positional(p)
00053           .run(),
00054           vm);
00055     notify(vm);
00056 
00057     if (vm.count("help")) {
00058         cerr << all_opt << endl;
00059         exit(1);
00060     }
00061 
00062     if (installation.empty()) {
00063         cerr << "'installation' parameter is required" << endl;
00064         exit(1);
00065     }
00066 
00067     std::shared_ptr<ServiceProxies> proxies(new ServiceProxies());
00068     proxies->useZookeeper(zookeeperUri, installation);
00069     proxies->config->dump(cerr);
00070 }
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator