当前位置: 首页>>代码示例>>C#>>正文


C# Spi.TriggerFiredBundle类代码示例

本文整理汇总了C#中Quartz.Spi.TriggerFiredBundle的典型用法代码示例。如果您正苦于以下问题:C# TriggerFiredBundle类的具体用法?C# TriggerFiredBundle怎么用?C# TriggerFiredBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TriggerFiredBundle类属于Quartz.Spi命名空间,在下文中一共展示了TriggerFiredBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewJob

        /// <summary>
        /// Called by the scheduler at the time of the trigger firing, in order to
        ///                         produce a <see cref="T:Quartz.IJob"/> instance on which to call Execute.
        /// 
        /// </summary>
        /// 
        /// <remarks>
        /// It should be extremely rare for this method to throw an exception -
        ///                         basically only the the case where there is no way at all to instantiate
        ///                         and prepare the Job for execution.  When the exception is thrown, the
        ///                         Scheduler will move all triggers associated with the Job into the
        ///                         <see cref="F:Quartz.TriggerState.Error"/> state, which will require human
        ///                         intervention (e.g. an application restart after fixing whatever
        ///                         configuration problem led to the issue wih instantiating the Job.
        /// 
        /// </remarks>
        /// <param name="bundle">The TriggerFiredBundle from which the <see cref="T:Quartz.IJobDetail"/>
        ///                           and other info relating to the trigger firing can be obtained.
        ///                         </param><param name="scheduler">a handle to the scheduler that is about to execute the job</param><throws>SchedulerException if there is a problem instantiating the Job. </throws>
        /// <returns>
        /// the newly instantiated Job
        /// 
        /// </returns>
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var jobType = bundle.JobDetail.JobType.FullName;
            TenantId tenantId = null;
            if (bundle.JobDetail.JobDataMap.ContainsKey(JobKeys.TenantId))
            {
                tenantId = new TenantId(
                    bundle.JobDetail.JobDataMap.GetString(JobKeys.TenantId)
                    );
                Logger.DebugFormat("new job {0} on tenant {1}", jobType, tenantId );
            }
            else
            {
                if (typeof (ITenantJob).IsAssignableFrom(bundle.JobDetail.JobType))
                {
                    string message = String.Format("Job {0}: missing tenantId", jobType);
                    Logger.Error(message);
                    throw new Exception(message);
                }

                Logger.DebugFormat("new job {0} without tenant", jobType);
            }

            var kernel = SelectKernel(tenantId);
            var job = this.ResolveByJobName ? 
                (IJob)kernel.Resolve(bundle.JobDetail.Key.ToString(), typeof(IJob)) :
                (IJob)kernel.Resolve(bundle.JobDetail.JobType);

            if (job is ITenantJob)
            {
                (job as ITenantJob).TenantId = new TenantId(tenantId);
            }

            return job;
        }
开发者ID:ProximoSrl,项目名称:Jarvis.DocumentStore,代码行数:58,代码来源:TenantJobFactory.cs

示例2: NewJob

 public IJob NewJob(TriggerFiredBundle bundle)
 {
     Type jobType = bundle.JobDetail.JobType;
     var job = ObjectFactory.GetInstance(jobType) as IJob;
     ObjectFactory.BuildUp(job);
     return job;
 }
开发者ID:quentinproust,项目名称:Little-Problem,代码行数:7,代码来源:SMJobFactory.cs

示例3: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var jobDetail = bundle.JobDetail;
            var jobType = jobDetail.JobType;

            try
            {
                if (Log.IsDebugEnabled)
                {
                    Log.Debug(string.Format("Producing instance of Job '{0}', class={1}",
                        new object[] { jobDetail.Key, jobType.FullName }));
                }

                var disallowConcurent =
                    jobType.GetCustomAttributes(typeof(DisallowConcurrentExecutionAttribute), true).Length == 1;

                return typeof(IInterruptableJob).IsAssignableFrom(jobType)
                    ? disallowConcurent
                        ? new InterruptableDisallowConcurrentExecutionJobWrapper(bundle, _container)
                        : new InterruptableJobWrapper(bundle, _container)
                    : disallowConcurent
                        ? new DisallowConcurrentExecutionJobWrapper(bundle, _container)
                        : new JobWrapper(bundle, _container);
            }
            catch (Exception ex)
            {
                throw new SchedulerException(
                    string.Format("Problem instantiating class '{0}'", new object[] { jobDetail.JobType.FullName }), ex);
            }
        }
开发者ID:cutstock,项目名称:SampleWebService,代码行数:30,代码来源:UnityJobFactory.cs

示例4: CreateJobInstance

 /// <summary> 
 /// Create the job instance, populating it with property values taken
 /// from the scheduler context, job data map and trigger data map.
 /// </summary>
 protected override object CreateJobInstance(TriggerFiredBundle bundle)
 {
     ObjectWrapper ow = new ObjectWrapper(bundle.JobDetail.JobType);
     if (IsEligibleForPropertyPopulation(ow.WrappedInstance))
     {
         MutablePropertyValues pvs = new MutablePropertyValues();
         if (schedulerContext != null)
         {
             pvs.AddAll(schedulerContext);
         }
         pvs.AddAll(bundle.JobDetail.JobDataMap);
         pvs.AddAll(bundle.Trigger.JobDataMap);
         if (ignoredUnknownProperties != null)
         {
             for (int i = 0; i < ignoredUnknownProperties.Length; i++)
             {
                 string propName = ignoredUnknownProperties[i];
                 if (pvs.Contains(propName))
                 {
                     pvs.Remove(propName);
                 }
             }
             ow.SetPropertyValues(pvs);
         }
         else
         {
             ow.SetPropertyValues(pvs, true);
         }
     }
     return ow.WrappedInstance;
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:35,代码来源:SpringObjectJobFactory.cs

示例5: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var jobDetail = bundle.JobDetail;
            var jobType = jobDetail.JobType;

            try
            {
                if (Log.IsDebugEnabled)
                {
                    Log.Debug(string.Format(
                        CultureInfo.InvariantCulture,
                        "Producing instance of Job '{0}', class={1}", new object[] { jobDetail.Key, jobType.FullName }));
                }

                return typeof(IInterruptableJob).IsAssignableFrom(jobType)
                    ? new InterruptableJobWrapper(bundle, container)
                    : new JobWrapper(bundle, container);
            }
            catch (Exception ex)
            {
                throw new SchedulerException(string.Format(
                    CultureInfo.InvariantCulture,
                    "Problem instantiating class '{0}'", new object[] { jobDetail.JobType.FullName }), ex);
            }
        }
开发者ID:wezmag,项目名称:Quartz.Unity,代码行数:25,代码来源:UnityJobFactory.cs

示例6: Initialize

		/// <summary>
		/// Initializes the job execution context with given scheduler and bundle.
		/// </summary>
		/// <param name="sched">The scheduler.</param>
		/// <param name="firedBundle">The bundle offired triggers.</param>
		public virtual void Initialize(QuartzScheduler sched, TriggerFiredBundle firedBundle)
		{
			qs = sched;

			IJob job;
			JobDetail jobDetail = firedBundle.JobDetail;

			try
			{
				job = sched.JobFactory.NewJob(firedBundle);
			}
			catch (SchedulerException se)
			{
				sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.FullName), se);
				throw;
			}
			catch (Exception e)
			{
				SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Problem instantiating type '{0}'", jobDetail.JobType.FullName), e);
				sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.FullName), se);
				throw se;
			}

			jec = new JobExecutionContext(scheduler, firedBundle, job);
		}
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:30,代码来源:JobRunShell.cs

示例7: NewJob

        /// <summary>
        /// Creates a new job resolved from the IoC container.
        /// </summary>
        /// <param name="bundle">Trigger fired bundle instance.</param>
        /// <param name="scheduler">Scheduler instance.</param>
        /// <returns>Returns a new job resolved from the IoC container.</returns>
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            if (bundle == null)
                throw new ArgumentNullException("bundle");

            return (IJob)this._container.Resolve(bundle.JobDetail.JobType);
        }
开发者ID:mattb1024,项目名称:SmartSheetService,代码行数:13,代码来源:SmartSheetJobFactory.cs

示例8: NewJob

 /// <summary>
 /// Called by the scheduler at the time of the trigger firing, in order to produce
 /// a Quartz.IJob instance on which to call Execute
 /// </summary>
 /// <param name="bundle">The TriggerFiredBundle from which the Quartz.IJobDetail and other info relating to the trigger firing can be obtained.</param>
 /// <param name="scheduler">A handle to the scheduler that is about to execute the job</param>
 /// <returns>The new intance of IJob</returns>
 public IJob NewJob(
     TriggerFiredBundle bundle,
     IScheduler scheduler)
 {
     return (IJob)_container
         .GetInstance(bundle.JobDetail.JobType);
 }
开发者ID:c4rm4x,项目名称:C4rm4x.WebApi,代码行数:14,代码来源:SimpleInjectorJobFactory.cs

示例9: NewJob

        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var jobAdapter = (IJob)_components.Resolve(
                bundle.JobDetail.JobType,
                new TypedParameter(typeof(IJobDetail), bundle.JobDetail));

            return jobAdapter;
        }
开发者ID:votrongdao,项目名称:NWheels,代码行数:9,代码来源:AutofacJobFactory.cs

示例10: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            if (bundle == null) throw new ArgumentNullException("bundle");
            if (scheduler == null) throw new ArgumentNullException("scheduler");

            var job = (IJob)IocManager.Instance.Resolve(bundle.JobDetail.JobType);
            return job;
        }
开发者ID:MadBullfrog,项目名称:Topshelf.Abp.Integrations,代码行数:8,代码来源:AbpJobFactory.cs

示例11: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var type = bundle.JobDetail.JobType;

            _logger.Info("Job {0} was created", type.FullName);

            return _kernel.Get(type) as IJob;
        }
开发者ID:mamluka,项目名称:SpeedyMailer,代码行数:8,代码来源:ContainerJobFactory.cs

示例12: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var jobType = typeof(AutofacOwnedJob<>).MakeGenericType(new[] { bundle.JobDetail.JobType });

            var job = this.container.Resolve(jobType);

            return (IJob)job;
        }
开发者ID:Firebuild,项目名称:Firebuild,代码行数:8,代码来源:JobFactory.cs

示例13: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            IJobDetail jobDetail = bundle.JobDetail;
            if (jobDetail == null)
                throw new SchedulerException("JobDetail was null");

            Type type = jobDetail.JobType;

            return _typeFactories[type].NewJob(bundle, scheduler);
        }
开发者ID:jeppster,项目名称:MassTransit-Quartz,代码行数:10,代码来源:MassTransitJobFactory.cs

示例14: NewJob

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            var jobDetail = bundle.JobDetail;
            if (jobDetail == null)
                throw new SchedulerException("JobDetail was null");

            var type = jobDetail.JobType;

            return _typeFactories.GetOrAdd(type, CreateJobFactory)
                .NewJob(bundle, scheduler);
        }
开发者ID:MassTransit,项目名称:MassTransit,代码行数:11,代码来源:MassTransitJobFactory.cs

示例15: NewJob

 public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
 {
     try
     {
         return (IJob)_lifetimeScope.Resolve(bundle.JobDetail.JobType);
     }
     catch (Exception e)
     {
         throw new SchedulerException("Problem instantiating class: " + e.Message, e);
     }
 }
开发者ID:k-best,项目名称:BackgroundJobHost,代码行数:11,代码来源:AutofacQuartzJobFactory.cs


注:本文中的Quartz.Spi.TriggerFiredBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。