當前位置: 首頁>>代碼示例>>C#>>正文


C# StdSchedulerFactory.Initialize方法代碼示例

本文整理匯總了C#中Quartz.Impl.StdSchedulerFactory.Initialize方法的典型用法代碼示例。如果您正苦於以下問題:C# StdSchedulerFactory.Initialize方法的具體用法?C# StdSchedulerFactory.Initialize怎麽用?C# StdSchedulerFactory.Initialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Quartz.Impl.StdSchedulerFactory的用法示例。


在下文中一共展示了StdSchedulerFactory.Initialize方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestMethod1

        public void TestMethod1()
        {
            var quartzBuilder = new StdSchedulerFactory();
            quartzBuilder.Initialize();

            var bus = ServiceBusFactory.New(sbi =>
            {
                sbi.UseMsmq();
                sbi.UseMulticastSubscriptionClient();
                sbi.ReceiveFrom("msmq://localhost/clustertest-1");
                sbi.UseClusterService(cc =>
                {
                    cc.SetEndpointIndex(1);
                    cc.SetElectionPeriod(TimeSpan.FromSeconds(5));
                    cc.UseScheduler(quartzBuilder.GetScheduler);
                });
                sbi.EnableMessageTracing();
                sbi.UseNLog(_logFactory);
            });

            var evt = new ManualResetEventSlim(false);
            bus.SubscribeHandler<TimeoutExpired>(m =>
            {
                evt.Set();
            });

            Thread.Sleep(5000);

            bus.Publish(new ScheduleTimeout(Guid.Empty, TimeSpan.FromSeconds(10)));

            Assert.IsTrue(evt.Wait(TimeSpan.FromSeconds(30)), "Didn't get a timeout expired message");
        }
開發者ID:fivepmtechnology,項目名稱:MassTransit-Cluster,代碼行數:32,代碼來源:BasicSchedulerTests.cs

示例2: Init

        public void Init()
        {
            Configure.Instance.Configurer.ConfigureComponent<IScheduler>(() =>
            {
                var factory = new StdSchedulerFactory();
                factory.Initialize();

                var scheduler = factory.GetScheduler();
                return scheduler;
            }, DependencyLifecycle.SingleInstance);
        }
開發者ID:sanilpaul,項目名稱:Quartz-NServicebus,代碼行數:11,代碼來源:ContainerInitialization.cs

示例3: TestFactoryShouldOverrideConfigurationWithSysProperties

        public void TestFactoryShouldOverrideConfigurationWithSysProperties()
        {
            NameValueCollection properties = new NameValueCollection();
            var factory = new StdSchedulerFactory();
            factory.Initialize();
            var scheduler = factory.GetScheduler();
            Assert.AreEqual("DefaultQuartzScheduler", scheduler.SchedulerName);

            Environment.SetEnvironmentVariable("quartz.scheduler.instanceName", "fromSystemProperties");
            factory = new StdSchedulerFactory();
            scheduler = factory.GetScheduler();
            Assert.AreEqual("fromSystemProperties", scheduler.SchedulerName);
        }
開發者ID:vaskosound,項目名稱:FantasyLeagueStats,代碼行數:13,代碼來源:StdSchedulerFactoryTest.cs

示例4: Init

        public void Init()
        {
            var configurer = Configure.Instance.Configurer;
            configurer.ConfigureComponent<IJobFactory>(() => new QuartzJobFactory(Configure.Instance.Builder),DependencyLifecycle.InstancePerUnitOfWork);
            configurer.ConfigureComponent<IScheduler>(() =>
            {
                var factoryx = new StdSchedulerFactory();
                factoryx.Initialize();

                var scheduler = factoryx.GetScheduler();
                scheduler.JobFactory = Configure.Instance.Builder.Build<IJobFactory>();
                return scheduler;
            }, DependencyLifecycle.SingleInstance);
            configurer.ConfigureComponent<DoSomethingJob>(DependencyLifecycle.InstancePerUnitOfWork);
        }
開發者ID:sanilpaul,項目名稱:QuartzNServiceBusSample,代碼行數:15,代碼來源:EndpointConfig.cs

示例5: QuartzRegistry

        public QuartzRegistry(IContainer container)
        {
            For<IJobFactory>().Use(() => new QuartzJobFactory(container));
            For<IScheduler>().Singleton().Use(() =>
            {
                var stdSchedulerFactory = new StdSchedulerFactory();
                stdSchedulerFactory.Initialize();

                var scheduler = stdSchedulerFactory.GetScheduler();

                scheduler.JobFactory = container.GetInstance<IJobFactory>();

                return scheduler;
            });
        }
開發者ID:francis04j,項目名稱:LayeredArchitecture,代碼行數:15,代碼來源:QuartzRegistry.cs

示例6: TestFactoryShouldOverrideConfigurationWithSysProperties

        public async Task TestFactoryShouldOverrideConfigurationWithSysProperties()
        {
            NameValueCollection properties = new NameValueCollection();
            properties["quartz.serializer.type"] = TestConstants.DefaultSerializerType;
            var factory = new StdSchedulerFactory(properties);

            factory.Initialize();
            var scheduler = await factory.GetScheduler();
            Assert.AreEqual("QuartzScheduler", scheduler.SchedulerName);

            Environment.SetEnvironmentVariable("quartz.scheduler.instanceName", "fromSystemProperties");
            // Make sure to pass the serializer type as an env var instead of in a NameValueCollection (as in the previous test)
            // since passing an explicit NameValueCollection causes the scheduler factory to not check environment variables
            Environment.SetEnvironmentVariable("quartz.serializer.type", TestConstants.DefaultSerializerType);
            factory = new StdSchedulerFactory();
            scheduler = await factory.GetScheduler();
            Assert.AreEqual("fromSystemProperties", scheduler.SchedulerName);
        }
開發者ID:jvilalta,項目名稱:quartznet,代碼行數:18,代碼來源:StdSchedulerFactoryTest.cs

示例7: GetSchedulerFactory

        /// <summary>
        /// Gets the scheduler factory.
        /// </summary>
        /// <returns>The ISchedulerFactory.</returns>
        private static ISchedulerFactory GetSchedulerFactory()
        {
            var result = new StdSchedulerFactory();

            var props = ConfigurationManager.GetSection(QuartzConfigurationSectionName);

            if (props != null)
            {
                // Initialize factory with settings from config file.
                result.Initialize();
            }
            else
            {
                result.Initialize(GetDefaultProperties());
            }

            return result;
        }
開發者ID:mparsin,項目名稱:Elements,代碼行數:22,代碼來源:ActionManagerScheduler.cs


注:本文中的Quartz.Impl.StdSchedulerFactory.Initialize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。