public void Initialize() { _container = Bootstrapper.ConfigureContainer(); _container.RegisterTestDoubles(); _scheduler = _container.Resolve <ISyncAgentScheduler>(); _repository = _container.Resolve <ISyncAgentTaskRepository>(); }
public async Task PlanExecution(ISyncAgentScheduler scheduler, Dictionary <string, object> dataParams = null) { IJobDetail job = JobBuilder.Create <JobSchedulerJob>() .WithIdentity(nameof(JobSchedulerJob)) .Build(); ITrigger trigger = TriggerBuilder.Create() .StartNow() .WithSimpleSchedule(x => x .WithIntervalInSeconds(5) .WithMisfireHandlingInstructionIgnoreMisfires() .RepeatForever()) .Build(); job.JobDataMap.Put("Scheduler", scheduler); //todo to const await scheduler.PlanJob(job, trigger); }
public async Task PlanExecution(ISyncAgentScheduler scheduler, Dictionary <string, object> dataParams = null) { if (dataParams != null && dataParams.ContainsKey(nameof(SyncAgentTask))) //todo keys to const { if (dataParams[nameof(SyncAgentTask)] is SyncAgentTask syncAgentTask) { IJobDetail job = JobBuilder.Create <IsolatedWorkExecutorJob>() .WithIdentity(syncAgentTask.Id.ToString()) .Build(); ITrigger trigger = TriggerBuilder.Create() .StartNow() .Build(); job.JobDataMap.Put(nameof(SyncAgentTask), syncAgentTask); await scheduler.PlanJob(job, trigger); return; } } throw new ArgumentException($"Parameter {nameof(SyncAgentTask)} is required to plan execution of {nameof(IsolatedWorkExecutorJob)}"); }
public PlanTasksJob(ISyncAgentScheduler scheduler) { _scheduler = scheduler; }