当前位置: 首页>>代码示例>>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;未经允许,请勿转载。