Пример #1
0
        public bool AddAssemblyJob(JobParamAssemblyModel job)
        {
            try
            {
                string   path     = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, job.AssemblyDllName);
                Assembly assembly = Assembly.LoadFile(path);

                var    type   = assembly.GetType(job.TypeFullName);
                JobKey jobKey = CreateJobKey(job.JobName, job.JobGroupName);
                var    bl     = _scheduler.CheckExists(jobKey).GetAwaiter().GetResult();
                if (!bl)
                {
                    IJobDetail jobDetail = JobBuilder.Create(type)
                                           .WithIdentity(jobKey)
                                           .Build();

                    ITrigger trigger = CreateTrigger(job, jobKey);

                    _scheduler.ScheduleJob(jobDetail, trigger).GetAwaiter().GetResult();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return(false);
        }
Пример #2
0
 public static JobParamBaseModel GetJobParamBase(string jobName, string jobGroupName)
 {
     if (jobGroupName.Contains(JobConfig.JobGroupNameHttp))
     {
         JobParamHttpModel model = new JobParamHttpModel();
         model.JobName = jobName;
         return(model);
     }
     else
     {
         JobParamAssemblyModel model = new JobParamAssemblyModel();
         model.JobName = jobName;
         return(model);
     }
 }
Пример #3
0
 public bool AddAssemblyJob(JobParamAssemblyModel job)
 {
     return(_jobStore.AddAssemblyJob(job));
 }