Changes to Subscription Handler
[ric-app/hw.git] / src / hw_xapp_main.cc
index 1771797..a4a5eef 100644 (file)
@@ -60,29 +60,36 @@ int main(int argc, char *argv[]){
 
 
        //Create Subscription Handler if Xapp deals with Subscription.
-       std::unique_ptr<SubscriptionHandler> sub_handler = std::make_unique<SubscriptionHandler>();
+       //std::unique_ptr<SubscriptionHandler> sub_handler = std::make_unique<SubscriptionHandler>();
+
+       SubscriptionHandler sub_handler;
 
        //create HelloWorld Xapp Instance.
        std::unique_ptr<Xapp> hw_xapp;
        hw_xapp = std::make_unique<Xapp>(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]);
        mdclog_write(MDCLOG_INFO, "Starting Listener Threads. Number of Workers = %d", num_threads);
 
-       std::unique_ptr<XappMsgHandler> mp_handler = std::make_unique<XappMsgHandler>(config[XappSettings::SettingName::XAPP_ID]);
+       std::unique_ptr<XappMsgHandler> mp_handler = std::make_unique<XappMsgHandler>(config[XappSettings::SettingName::XAPP_ID], sub_handler);
+
        hw_xapp->start_xapp_receiver(std::ref(*mp_handler));
 
        sleep(1);
 
-       //xapp->shutdown();
+
+
+    //hw_xapp->Run() //for spinning multiple receiving threads.
+
+       //hw_xapp->shutdown();
 
        while(1){
                                sleep(1);