/// <summary>
        /// 初始化实例
        /// </summary>
        /// <param name="scheduleType"></param>
        /// <param name="isLoop">是否循环处理</param>
        /// <param name="defaultNextWaitMillisecondsIfEmpty">循环队列为空时默认等待下次执行的时间(毫秒)间隔,如连续为empty,等待时间为当前设置时间的倍数</param>
        public QueueSchedulerService(QueueScheduleType scheduleType, bool isLoop = true, int defaultNextWaitMillisecondsIfEmpty = 100)
        {
            ServiceType = scheduleType;

            ServiceName = SysData.GetQueueServiceName((int)ServiceType);

            RedisConfig = Startup.ScheduleRedisConfigs[scheduleType];

            this._isLoop = isLoop;

            this._defaultNextWaitMillisecondsIfEmpty = defaultNextWaitMillisecondsIfEmpty;
        }
Exemple #2
0
        /// <summary>
        /// 任务计划数据在Redi中的配置信息
        /// </summary>
        void ShowScheduleRedisConfig()
        {
            StringBuilder sb = new StringBuilder();

            foreach (var config in Startup.ScheduleRedisConfigs.Items)
            {
                var servName = SysData.GetQueueServiceName(config.ScheduleName);
                sb.AppendLine(string.Format("任务名:{0}", servName));

                string server    = null;
                Regex  regServer = new Regex(@"(?<server>[0-9a-z\-]+(\.[0-9a-z\-]+)+)", RegexOptions.IgnoreCase);
                var    dcoll     = regServer.Match(config.ConnectionString);
                if (null != dcoll)
                {
                    server = dcoll.Groups["server"].Value;
                }
                sb.AppendLine(string.Format("   Redis服务器:{0}", server));
                sb.AppendLine(string.Format("   Redis存储数据库序号:{0}", config.DbIndex));
                sb.AppendLine(string.Format("   Redis存储Key:{0}", config.Key));
                sb.AppendLine();
            }

            WriteOutConfig(sb.ToString(), true);
        }