예제 #1
0
        public static void AddQueue(this IServiceCollection services)
        {
            Scheduler scheduler = SchedulerHost.GetSchedulerInstance();
            IQueue    queue     = scheduler.UseQueue();

            services.AddSingleton <IQueue>(queue);
        }
        protected override void LazyInit()
        {
            NameValueCollection properties = null;

            try
            {
                var hosts = SchedulerHost.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                foreach (var host in hosts)
                {
                    properties = GetSchedulerProperties();
                    properties["quartz.scheduler.proxy.address"] = host;
                    ISchedulerFactory schedulerFactory = new StdSchedulerFactory(properties);
                    _scheduler.Add(schedulerFactory.GetScheduler());
                    InitScheduler(_scheduler);
                }
            }
            catch (Exception ex)
            {
                throw new SchedulerProviderException("Could not initialize scheduler", ex, properties);
            }

            if (_scheduler == null || _scheduler.Count == 0)
            {
                throw new SchedulerProviderException(
                          "Could not initialize scheduler", properties);
            }
        }
예제 #3
0
        public SchedulerHostStub(params GroupStub[] groups)
        {
            Groups = new List <GroupStub>(groups);

            SchedulerCommander = new SchedulerCommanderStub(Groups);
            SchedulerClerk     = new SchedulerClerkStub(Groups);

            Value = new SchedulerHost(SchedulerClerk, SchedulerCommander, new Version(1, 0, 0, 0), null, null);
        }
예제 #4
0
        public static IHostedScheduler AddScheduler(this IServiceCollection services, Action <IScheduler> configScheduledTasks)
        {
            Scheduler scheduler = SchedulerHost.GetSchedulerInstance();

            services.AddHostedService <SchedulerHost>();
            configScheduledTasks(scheduler);

            return(scheduler);
        }
예제 #5
0
        public SubstitutableSchedulerHost()
        {
            SchedulerCommander = Substitute.For <ISchedulerCommander>();

            Value = new SchedulerHost(
                Substitute.For <ISchedulerClerk>(),
                SchedulerCommander,
                new Version(),
                Substitute.For <ISchedulerEventHub>(),
                Substitute.For <ISchedulerEventTarget>());
        }
예제 #6
0
        public SchedulerHostStub(Type[] allowedJobTypes, params GroupStub[] groups)
        {
            Groups = new List <GroupStub>(groups);

            SchedulerCommander = new SchedulerCommanderStub(Groups);
            SchedulerClerk     = new SchedulerClerkStub(Groups);

            Value = new SchedulerHost(
                SchedulerClerk,
                SchedulerCommander,
                new Version(1, 0, 0, 0),
                null,
                null,
                new AllowedJobTypesRegistryStub(allowedJobTypes));
        }
        private SchedulerHost AssignErrorHost(string primaryError, Version version = null, Exception exception = null)
        {
            _schedulerHost = new SchedulerHost(version, new[] { primaryError }.Concat(GetExceptionMessages(exception)).ToArray());

            return(_schedulerHost);
        }
 protected void RiseEvent(RawSchedulerEvent @event)
 {
     SchedulerHost.RaiseEvent(@event);
 }