示例#1
0
		public Service()
		{
			InitializeComponent();
			schedulerFactory = new StdSchedulerFactory(Common.Properties.QuartzSchedulerProperties);
			scheduler = schedulerFactory.GetScheduler();
			scheduler.AddGlobalJobListener(new MemcachedLogJobListener());
			AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
		}
        public BackgroundJobManager(MVC_Husk.Infrastructure.Logging.ILogger logger, IScheduler sched)
        {
            _jobs = new Jobs();
            _logger = logger;
            _scheduler = sched;

            if (!_scheduler.IsStarted)
            {
                _scheduler.Start();
                _scheduler.AddGlobalJobListener(new QueueUpdateManager());
                QuartzNetWebConsole.Setup.Scheduler = () => _scheduler;
                QuartzNetWebConsole.Setup.Logger = new MemoryLogger(10000);
            }
        }
示例#3
0
        public void TestSchedulerFactoryObjectWithListeners()
        {
            IJobFactory jobFactory = new AdaptableJobFactory();

            IScheduler scheduler = (IScheduler)mockery.CreateMock(typeof(IScheduler));

            ISchedulerListener schedulerListener     = new TestSchedulerListener();
            IJobListener       globalJobListener     = new TestJobListener();
            IJobListener       jobListener           = new TestJobListener();
            ITriggerListener   globalTriggerListener = new TestTriggerListener();
            ITriggerListener   triggerListener       = new TestTriggerListener();

            Expect.Call(scheduler.JobFactory = (jobFactory));
            scheduler.AddSchedulerListener(schedulerListener);
            scheduler.AddGlobalJobListener(globalJobListener);
            scheduler.AddJobListener(jobListener);
            scheduler.AddGlobalTriggerListener(globalTriggerListener);
            scheduler.AddTriggerListener(triggerListener);
            scheduler.Start();
            scheduler.Shutdown(false);

            mockery.ReplayAll();

            SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);

            schedulerFactoryObject.JobFactory             = (jobFactory);
            schedulerFactoryObject.SchedulerListeners     = (new ISchedulerListener[] { schedulerListener });
            schedulerFactoryObject.GlobalJobListeners     = (new IJobListener[] { globalJobListener });
            schedulerFactoryObject.JobListeners           = (new IJobListener[] { jobListener });
            schedulerFactoryObject.GlobalTriggerListeners = (new ITriggerListener[] { globalTriggerListener });
            schedulerFactoryObject.TriggerListeners       = (new ITriggerListener[] { triggerListener });
            try
            {
                schedulerFactoryObject.AfterPropertiesSet();
                schedulerFactoryObject.Start();
            }
            finally
            {
                schedulerFactoryObject.Dispose();
            }

            mockery.VerifyAll();
        }
示例#4
0
        static void Main(string[] args)
        {
            ISchedulerFactory schedFact            = new StdSchedulerFactory();
            IScheduler        scheduler            = schedFact.GetScheduler();
            IJobListener      retryableJobListener = new RetryableJobListener(scheduler);

            scheduler.AddGlobalJobListener(retryableJobListener);
            scheduler.Start();

            // construct job info
            JobDetail jobDetail = new JobDetail("DummyJob", null, typeof(DummyJob));

            // fire only once
            Trigger trigger = TriggerUtils.MakeImmediateTrigger(0, TimeSpan.Zero);

            trigger.Name = "Chuck Norris";

            // start
            scheduler.ScheduleJob(jobDetail, trigger);
        }
示例#5
0
 /// <summary>
 /// Called during creation of the <see cref="IScheduler" /> in order to give
 /// the <see cref="ISchedulerPlugin" /> a chance to Initialize.
 /// </summary>
 public virtual void Initialize(String pluginName, IScheduler sched)
 {
     name = pluginName;
     sched.AddGlobalJobListener(this);
 }
示例#6
0
        public void Initialize()
        {
            lock (SyncRoot)
            {
                if (_scheduler != null)
                    return;

                var schedulerFactory = new StdSchedulerFactory();

                _scheduler = schedulerFactory.GetScheduler();
                _scheduler.AddGlobalJobListener(new GlobalJobListener());
            }
        }
示例#7
0
 /// <summary>
 /// Called during creation of the <see cref="IScheduler" /> in order to give
 /// the <see cref="ISchedulerPlugin" /> a chance to Initialize.
 /// </summary>
 public virtual void Initialize(String pluginName, IScheduler sched)
 {
     name = pluginName;
     sched.AddGlobalJobListener(this);
 }