RIC-1017: xapp-frame may not be able to successfully subscribe to messages
[ric-plt/xapp-frame.git] / pkg / xapp / xapp.go
index 439c177..72a8d32 100755 (executable)
@@ -65,6 +65,7 @@ var (
        shutdownFlag       int32
        shutdownCnt        int32
        disableAlarmClient bool
+       isRegistered       bool
 )
 
 var startTime time.Time
@@ -81,6 +82,10 @@ func IsReady() bool {
        return Rmr != nil && Rmr.IsReady() && SdlStorage != nil && SdlStorage.IsReady()
 }
 
+func IsRegistered() bool {
+       return isRegistered
+}
+
 func SetReadyCB(cb ReadyCB, params interface{}) {
        readyCb = cb
        readyCbParams = params
@@ -109,6 +114,8 @@ func XappShutdownCb() {
        if shutdownCb != nil {
                shutdownCb()
        }
+
+       isRegistered = false
 }
 
 func registerXapp() {
@@ -121,6 +128,7 @@ func registerXapp() {
 
                Logger.Debug("Application='%s' is now up and ready, continue with registration ...", viper.GetString("name"))
                if err := doRegister(); err == nil {
+                       isRegistered = true
                        Logger.Info("Registration done, proceeding with startup ...")
                        break
                }