예제 #1
0
        public void Initialize()
        {
            _container = Bootstrapper.ConfigureContainer();
            _container.RegisterTestDoubles();

            _scheduler  = _container.Resolve <ISyncAgentScheduler>();
            _repository = _container.Resolve <ISyncAgentTaskRepository>();
        }
예제 #2
0
        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);
        }
예제 #3
0
        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)}");
        }
예제 #4
0
 public PlanTasksJob(ISyncAgentScheduler scheduler)
 {
     _scheduler = scheduler;
 }