Esempio n. 1
0
        public async Task Execute(IJobExecutionContext context)
        {
            JobDataMap data = context.JobDetail.JobDataMap;

            TaskBuss taskBuss = new TaskBuss();
            var      list     = taskBuss.GetJobsIds(
                data["taskDb"].ToString(),
                data["taskTable"].ToString(),
                data["taskKey"].ToString(),
                data["taskState"].ToString(),
                data["taskStateFrom"].ToString(),
                data["taskStateTo"].ToString()
                );

            var redis = RedisManager.getRedisConn();
            var db    = redis.GetDatabase(Global.REDIS_DB);

            foreach (string id in list)
            {
                await db.ListLeftPushAsync(Global.TASK_PREFIX + "." + data["taskCode"], id);
            }

            if (list.Count > 0)
            {
                await Global.Topic(data["taskCode"].ToString());

                Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "> " + "任务(" + data["taskCode"] + ")部署了" + list.Count + "个Job");
            }
        }
Esempio n. 2
0
        static void Subscribe()
        {
            var redis = RedisManager.getRedisConn();
            var queue = redis.GetSubscriber().Subscribe(CONFIG_TOPIC + "." + ENV + "." + GROUP);

            queue.OnMessage(action);
            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "> " + "已订阅" + CONFIG_TOPIC + "." + ENV + "." + GROUP + "配置更新");
        }
Esempio n. 3
0
        public async Task Execute(IJobExecutionContext context)
        {
            JobDataMap data  = context.JobDetail.JobDataMap;
            var        redis = RedisManager.getRedisConn();
            var        db    = redis.GetDatabase(Global.REDIS_DB);
            await Global.Topic(data["taskCode"].ToString());

            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "> " + "任务(" + data["taskCode"] + ")部署了1个Job");
        }
Esempio n. 4
0
 public static async Task Topic(string taskCode)
 {
     var redis = RedisManager.getRedisConn();
     var db    = redis.GetDatabase(Global.REDIS_DB);
     await db.PublishAsync(RedisManager.TaskTopic(taskCode), TOPIC_MESSAGE);
 }