Exemple #1
0
 public static void RefreashRedisServerIP()
 {
     try
     {
         using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString))
         {
             PubConn.Open();
             var dal    = new tb_config_dal();
             var config = dal.Get(PubConn, RedisConfig.RedisServerKey);
             if (config != null)
             {
                 RedisConfig.RedisServer = config.configvalue;
             }
         }
     }
     catch (Exception exp)
     {
         LogHelper.AddError(new Domain.Model.tb_error_model()
         {
             errorcreatetime = DateTime.Now,
             errortype       = (int)BSF.BaseService.TaskManager.SystemRuntime.EnumTaskLogType.SystemError,
             msg             = string.Format("从配置中获取{0}出错,", RedisConfig.RedisServerKey) + exp.DetailMessage(),
             nodeid          = 0,
             taskid          = 0
         });
     }
 }
Exemple #2
0
        /// <summary>
        /// 任务调度平台根据发布的任务时间配置,定时回调运行方法
        /// 开发人员的任务插件必须要重载并该方法
        /// </summary>
        public override void Run()
        {
            /*
             * this.OpenOperator 用于任务调度平台提供给第三方使用的所有api接口封装
             */
            ConfigHelper.LoadConfig(this.AppConfig["BusinessMQManageConnectString"]);
            var sql = @"";
            List <tb_partition_model>           userdpartitions = new List <tb_partition_model>();
            Dictionary <int, tb_datanode_model> datanodemodels  = new Dictionary <int, tb_datanode_model>();
            DateTime servertime = DateTime.Now;

            SqlHelper.ExcuteSql(this.AppConfig["BusinessMQManageConnectString"], (c) =>
            {
                tb_config_dal configdal = new tb_config_dal();
                sql = configdal.Get(c, "MQCreateTableSql").value;
                tb_partition_dal partitiondal = new tb_partition_dal();
                userdpartitions             = partitiondal.List(c, true);
                tb_datanode_dal datanodedal = new tb_datanode_dal();
                var ms = datanodedal.List(c);
                foreach (var m in ms)
                {
                    datanodemodels.Add(m.datanodepartition, m);
                }
                servertime = c.GetServerDate();
            });

            if (string.IsNullOrWhiteSpace(sql))
            {
                Error(this.AppConfig["BusinessMQManageConnectString"], "MQCreateTableSql未配置参数", new Exception("MQ未找到或者未配置MQCreateTableSql参数,用于每天创建消息分区表"));
                return;
            }

            foreach (var p in userdpartitions)
            {
                var      partitioninfo = XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.PartitionRuleHelper.GetPartitionIDInfo(p.partitionid);
                DateTime currenttime   = servertime.Date;
                while (currenttime <= servertime.Date.AddDays(3))                                                                                                      //预创建3天的表
                {
                    var tablename = XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.PartitionRuleHelper.GetTableName(partitioninfo.TablePartition, currenttime); //
                    SqlHelper.ExcuteSql(this.GetDataNodeConnectString(datanodemodels[partitioninfo.DataNodePartition]), (c) =>
                    {
                        bool exsit = c.TableIsExist(tablename);
                        if (exsit != true)
                        {
                            string cmd = sql.Replace("{tablepartiton}", XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.PartitionRuleHelper.PartitionNameRule(partitioninfo.TablePartition))
                                         .Replace("{daypartition}", currenttime.ToString("yyMMdd")).Replace("{datanodepartiton}", XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.PartitionRuleHelper.PartitionNameRule(partitioninfo.DataNodePartition));
                            c.ExecuteSql(cmd, new List <XXF.Db.ProcedureParameter>());
                        }
                    });
                    currenttime = currenttime.AddDays(1);
                }
            }
        }
Exemple #3
0
        public ActionResult Add(int?id)
        {
            return(this.Visit(EnumUserRole.Admin, () =>
            {
                if (id == null)
                {
                    return View();
                }
                using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString))
                {
                    PubConn.Open();
                    tb_config_dal dal = new tb_config_dal();

                    var model = dal.Get(PubConn, id.Value);
                    return View(model);
                }
            }));
        }
 public static void RefreashRedisServerIP()
 {
     try
     {
         using (DbConn PubConn = DbConn.CreateConn(GlobalConfig.ConnectionString))
         {
             PubConn.Open();
             var dal    = new tb_config_dal();
             var config = dal.Get(PubConn, RedisConfig.RedisServerKey);
             if (config != null)
             {
                 RedisConfig.RedisServer = config.configvalue;
             }
         }
     }
     catch (Exception exp)
     {
         LogHelper.AddNodeError(string.Format("从配置中获取{0}出错,", RedisConfig.RedisServerKey), exp);
     }
 }