Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrontabSchedulerJob{T}" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="crontabProcessorFactory">The crontab processor factory.</param>
        /// <param name="invokeMethodName">Name of the invoke method.</param>
        /// <param name="args">The job arguments.</param>
        /// <exception cref="ArgumentNullException">settings
        /// or
        /// invokeMethodName</exception>
        /// <exception cref="SchedulerInitializationException"></exception>
        /// <exception cref="ArgumentNullException">settings
        /// or
        /// invokeMethodName</exception>
        public CrontabSchedulerJob(ISchedulerJobSettings settings,
                                   ICrontabProcessorFactory crontabProcessorFactory,
                                   string invokeMethodName,
                                   IJobArgs args)
            : base(invokeMethodName, args)
        {
            if (invokeMethodName == null)
            {
                throw new ArgumentNullException(nameof(invokeMethodName));
            }

            Settings = settings ?? throw new ArgumentNullException(nameof(settings));
            _crontabProcessorFactory = crontabProcessorFactory ?? throw new ArgumentNullException(nameof(crontabProcessorFactory));
        }
 /// <summary>
 /// Creates the crontab based scheduler job.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="settings">The settings.</param>
 /// <param name="invokeMethodName">Name of the invoke method.</param>
 /// <param name="startupArgs">The startup arguments.</param>
 /// <returns></returns>
 public ICrontabSchedulerJob CreateCrontabJob <T>(ISchedulerJobSettings settings, string invokeMethodName, object?startupArgs) =>
 new CrontabSchedulerJob <T>(
     settings,
     new CrontabProcessorFactory(),
     invokeMethodName,
     CreateJobArgs(startupArgs));