/// <summary> /// Registers new instance of <see cref="IDirectoryScanListener"/> with the scheduler context, /// executes the job, and removes the instance from the scheduler context /// </summary> /// <param name="context"></param> public new void Execute(IJobExecutionContext context) { JobDataMap data = context.MergedJobDataMap; string callbackUrl = GetRequiredParameter(data, CallbackUrl); string listenerName = Guid.NewGuid().ToString(); var listener = new RDirectoryScanListener(callbackUrl); Logger.DebugFormat("Adding {0} to context.", listenerName); data.Put("DIRECTORY_SCAN_LISTENER_NAME", listenerName); context.Scheduler.Context.Add(listenerName, listener); base.Execute(context); context.Scheduler.Context.Remove(listenerName); }
/// <summary> /// Registers new instance of <see cref="IDirectoryScanListener"/> with the scheduler context, /// executes the job, and removes the instance from the scheduler context /// </summary> /// <param name="context"></param> public new void Execute(IJobExecutionContext context) { JobDataMap data = context.MergedJobDataMap; var jobName = context.JobDetail.Key.Name; string callbackUrl = GetRequiredParameter(data, CallbackUrl, jobName); string listenerName = Guid.NewGuid().ToString(); var listener = new RDirectoryScanListener(callbackUrl); Logger.DebugFormat("Adding {0} to context.", listenerName); data.Put("DIRECTORY_SCAN_LISTENER_NAME", listenerName); context.Scheduler.Context.Add(listenerName, listener); Logger.InfoFormat("Executing ({0})", jobName); base.Execute(context); context.Scheduler.Context.Remove(listenerName); }