debug_receiver.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "debug_receiver_handler.h"
  2. #include "debug_receiver_proto.h"
  3. #include <library/cpp/messagebus/ybus.h>
  4. #include <library/cpp/getopt/last_getopt.h>
  5. #include <library/cpp/lwtrace/all.h>
  6. using namespace NBus;
  7. int main(int argc, char** argv) {
  8. NLWTrace::StartLwtraceFromEnv();
  9. TBusQueueConfig queueConfig;
  10. TBusServerSessionConfig sessionConfig;
  11. NLastGetopt::TOpts opts;
  12. queueConfig.ConfigureLastGetopt(opts);
  13. sessionConfig.ConfigureLastGetopt(opts);
  14. opts.AddLongOption("port").Required().RequiredArgument("PORT").StoreResult(&sessionConfig.ListenPort);
  15. opts.SetFreeArgsMax(0);
  16. NLastGetopt::TOptsParseResult r(&opts, argc, argv);
  17. TBusMessageQueuePtr q(CreateMessageQueue(queueConfig));
  18. TDebugReceiverProtocol proto;
  19. TDebugReceiverHandler handler;
  20. TBusServerSessionPtr serverSession = TBusServerSession::Create(&proto, &handler, sessionConfig, q);
  21. // TODO: race is here
  22. handler.ServerSession = serverSession.Get();
  23. for (;;) {
  24. Sleep(TDuration::Hours(17));
  25. }
  26. return 0;
  27. }