public void DownLown(string clientid)
        {
            var tempId = _access.GetId(clientid);

            if (_appinfo != null && clientid == _appinfo.AppId)
            {
                _appinfo = null;
            }
            _access.UpdateStatus(tempId, AppStatus.Stoped);
            _logger.Trace(string.Format("设备下线处理 AppId;{0}", clientid));
        }
        public void UpdateStatus(string clientid, AppStatus status)
        {
            var temp = _access.GetOrRegisterListener(clientid);

            if (temp == null)
            {
                return;
            }
            if (_appinfo != null && clientid == _appinfo.AppId)
            {
                _appinfo = null;
            }
            _access.UpdateStatus(temp.Id, status);
        }
        public void Deploy(string clientid)
        {
            var temp = _access.GetOrRegisterListener(clientid);

            if (temp == null)
            {
                return;
            }
            if (_appinfo != null && clientid == _appinfo.AppId)
            {
                _appinfo = null;
            }
            _access.Deploy(temp.Id);
        }
 public void MqListenerInitialize(string clientid)
 {
     try
     {
         _appinfo = _access.GetOrRegisterListener(clientid);
         var versionInfo = AutoUpdaterInfo.Current;
         if (!string.Equals(versionInfo.Version, _appinfo.RunVersion, StringComparison.OrdinalIgnoreCase))
         {
             _access.UpdateVersion(_appinfo.Id, versionInfo.Version);
         }
         var newStatus = _access.Transform(_appinfo.Status);
         if (newStatus == AppStatus.Starting)
         {
             _access.UpdateStatus(_appinfo.Id, newStatus);
         }
         _logger.Debug(string.Format("初始化成功,当前运行版本:{0}", _appinfo.RunVersion));
     }
     catch (Exception ex)
     {
         _logger.Error(ex, "CheckVersion");
     }
 }
        /// <summary>
        /// 消息调度程序心跳
        /// </summary>
        /// <param name="clientid"></param>
        /// <param name="totalCount"></param>
        /// <param name="totalMsgSize"></param>
        /// <returns></returns>
        public bool MqListenerHeartbeat(string clientid, int totalCount, long totalMsgSize)
        {
            if (_appinfo == null)
            {
                _appinfo = _access.GetOrRegisterListener(clientid);
            }
            if (_appinfo.Status == AppStatus.Running)
            {
                _access.UpdateLastHeartTime(_appinfo.Id);
                _appinfo.LastHeartTime = DateTime.Now;
                return(true);
            }
            var newStatus = _access.Transform(_appinfo.Status);

            if (newStatus == AppStatus.Running || newStatus == AppStatus.Starting)
            {
                _access.Online(_appinfo.Id);
                _appinfo.Status = AppStatus.Running;
                return(true);
            }
            _logger.Error("MqListenerHeartbeat未做任何处理 status:" + newStatus);
            return(true);
        }