X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fhw_xapp_main.cc;h=a4a5eefaab9d89d6d391fa17d69e5e992c7d3f1a;hb=HEAD;hp=01601fb2adb2c3ffaca5937514c83221cd70e8b8;hpb=a2f64d55efc2da9611f3cabe11a36370a553c186;p=ric-app%2Fhw.git diff --git a/src/hw_xapp_main.cc b/src/hw_xapp_main.cc index 01601fb..a4a5eef 100644 --- a/src/hw_xapp_main.cc +++ b/src/hw_xapp_main.cc @@ -60,38 +60,36 @@ int main(int argc, char *argv[]){ //Create Subscription Handler if Xapp deals with Subscription. - std::unique_ptr sub_handler = std::make_unique(); + //std::unique_ptr sub_handler = std::make_unique(); + + SubscriptionHandler sub_handler; //create HelloWorld Xapp Instance. std::unique_ptr hw_xapp; hw_xapp = std::make_unique(std::ref(config),std::ref(*rmr)); mdclog_write(MDCLOG_INFO, "Created Hello World Xapp Instance"); - - sleep(1); //Startup E2 subscription and A1 policy - hw_xapp->startup(std::ref(*sub_handler)); + hw_xapp->startup(sub_handler); + + sleep(10); //start listener threads and register message handlers. int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]); - bool sub_required = true; - for(int j=0; j < num_threads; j++) { - std::unique_ptr mp_handler; - if(sub_required) - mp_handler = std::make_unique(config[XappSettings::SettingName::XAPP_ID], std::ref(*sub_handler)); - else - mp_handler = std::make_unique(config[XappSettings::SettingName::XAPP_ID]); + mdclog_write(MDCLOG_INFO, "Starting Listener Threads. Number of Workers = %d", num_threads); + + std::unique_ptr mp_handler = std::make_unique(config[XappSettings::SettingName::XAPP_ID], sub_handler); + + hw_xapp->start_xapp_receiver(std::ref(*mp_handler)); + + sleep(1); - hw_xapp->register_handler(std::ref(*mp_handler)); - } - mdclog_write(MDCLOG_INFO, "Starting Listener Threads. Number of Workers = %d", num_threads); - hw_xapp->Run(); + //hw_xapp->Run() //for spinning multiple receiving threads. - //Delete all subscriptions if any based on Xapp Mode. - //xapp->shutdown(); + //hw_xapp->shutdown(); while(1){ sleep(1);