Ejemplo n.º 1
0
        /// <summary>
        /// 执行更新操作
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public InvokeResult ProcessJobDataViaQueue(BackgroundJobLog dto)
        {
            var systemHealthBll = SystemHealthBll._();
            var success         = false;

            switch (int.Parse(dto.jobType))
            {
            case (int)BackgroundJobType.Normal:    //数据分析
                success = new EasyNetQHelper().VhGeneraterHelper(RabbitMqVirtualHostType.SystemDataAnalyse).Broadcast(dto);
                break;

            case (int)BackgroundJobType.SytemHealth:    //站点健康检测
                success = new EasyNetQHelper().VhGeneraterHelper(RabbitMqVirtualHostType.SystemHealth).Broadcast(dto);
                break;

            //管理器
            case (int)BackgroundJobType.Manager: break;

            //更新器
            case (int)BackgroundJobType.Updater: break;

            default:
                break;
            }
            //添加日志处理队列
            Task.Run(() => { new EasyNetQHelper().VhGeneraterHelper(RabbitMqVirtualHostType.LogAnalyse).Broadcast <BackgroundJobLog>(dto); });
            return(new InvokeResult()
            {
                Status = success ? Status.Successful : Status.Failed
            });
        }
Ejemplo n.º 2
0
        public InvokeResult ProcessJobDataImedicate(BackgroundJobLog jobLog)
        {
            var          systemHealthBll = SystemHealthBll._();
            var          success         = false;
            var          content         = jobLog.runLog;
            BsonDocument bsonDoc         = null;

            if (!string.IsNullOrEmpty(content))
            {
                bsonDoc = MongoDB.Bson.Serialization.BsonSerializer.Deserialize <BsonDocument>(jobLog.runLog);
            }
            if (bsonDoc == null)
            {
                return new InvokeResult()
                       {
                           Status = Status.Successful
                       }
            }
            ;
            switch (int.Parse(jobLog.jobType))
            {
            case (int)BackgroundJobType.Normal:    //数据分析
                var json = ReceiveSaveData.SaveData(bsonDoc.String("execData"), jobLog.customerCode);

                break;

            case (int)BackgroundJobType.SytemHealth:    //站点健康检测,发送错误邮件

                if (bsonDoc != null)
                {
                    if (!string.IsNullOrEmpty(bsonDoc.Text("execData")))
                    {
                        ///发送PushInfo异常信息到站点
                        var messageInfo = MongoDB.Bson.Serialization.BsonSerializer.Deserialize <PushMessageInfo>(bsonDoc.Text("execData"));
                        ProcessPushMessageInfo(messageInfo);
                    }
                }
                break;

            //管理器
            case (int)BackgroundJobType.Manager: break;

            //更新器
            case (int)BackgroundJobType.Updater: break;

            default:
                break;
            }
            //添加日志处理队列,发送到日志平台
            var result = CreateLog(jobLog);

            return(new InvokeResult()
            {
                Status = success ? Status.Successful : Status.Failed
            });
        }