Exemple #1
0
        /// <summary>
        /// Workers this instance.
        /// </summary>
        private void Worker()
        {
            log.Debug("Enter in Worker... Installing");

            QuartzJobs.CreateJob(new JobDetails <QuartzController>
            {
                Name           = "Viva.Template.WS.Job",
                CronExpression = ConfigurationManager.AppSettings["ExecCronExpression"]
            });

            // Add more jobs if is necessary before start.
            QuartzJobs.StartJobs();

            this.shutdownEvent.WaitOne();
        }
        public void FireTrigger(QuartzJobs job)
        {
            IJobDetail jobDetail;

            if (_jobDetails.TryGetValue(job, out jobDetail))
            {
                try
                {
                    _scheduler.TriggerJob(jobDetail.Key);
                }
                catch (Exception exception)
                {
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Stops this instance.
        /// </summary>
        public void Stop()
        {
            log.Info("Stop service.");
            try
            {
                QuartzJobs.StopJobs();
                this.shutdownEvent.Set();

                if (!this.thread.Join(3000))
                {
                    this.thread.Abort();
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
                throw;
            }
        }
Exemple #4
0
 public void Run()
 {
     QuartzJobs = new QuartzJobs();
     QuartzJobs.Start();
 }