RIC-1017: xapp-frame may not be able to successfully subscribe to messages 38/11838/1 v0.9.21
authorTuan Nguyen <hoang.su.tk@gmail.com>
Fri, 29 Sep 2023 09:11:45 +0000 (09:11 +0000)
committerTuan Nguyen <hoang.su.tk@gmail.com>
Fri, 29 Sep 2023 09:12:08 +0000 (09:12 +0000)
Change-Id: I18a186a9017818a3464dd7e1f3f637285da4398c
Signed-off-by: Tuan Nguyen <hoang.su.tk@gmail.com>
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
                }