public static class QuartzScheduler
{ public static IScheduler Create() { var quartzProperties = new NameValueCollection { {"quartz.scheduler.instanceName", Environment.MachineName}, {"quartz.scheduler.instanceId", "bulkquote"}, {"quartz.threadPool.threadCount", "10"}, {"quartz.threadPool.threadPriority", "Normal"}, {"quartz.scheduler.idleWaitTime", "5000"}, {"quartz.jobStore.misfireThreshold", "60000"}, {"quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"}, {"quartz.jobStore.tablePrefix", "QRTZ_"}, {"quartz.jobStore.clustered", "false"}, {"quartz.jobStore.driverDelegateType", "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"}, {"quartz.jobStore.dataSource", "MySqlServerFullVersion"}, {"quartz.dataSource.MySqlServerFullVersion.connectionString", ConfigurationManager.ConnectionStrings["QuartzConnectionString"].ConnectionString}, {"quartz.dataSource.MySqlServerFullVersion.provider", "SqlServer-20"} };
ISchedulerFactory schedulerFactory = new StdSchedulerFactory(quartzProperties); var scheduler = schedulerFactory.GetScheduler();
return scheduler; } } _scheduler = QuartzScheduler.Create(); _bus = MassTransit.Bus.Factory.CreateUsingRabbitMq(configurator => { var host = configurator.Host(new Uri("rabbitmq://localhost/"), h => { h.Username(RabbitUserName); h.Password(RabbitPassword); }); configurator.UseMessageScheduler(new Uri("rabbitmq://localhost/quartz")); configurator.ReceiveEndpoint(host, "HomeRisks", endpointConfigurator => { endpointConfigurator.PrefetchCount = MaxConcurrentThreads; endpointConfigurator.Consumer(() => _container.Resolve<GetHomeQuoteBulkQuoteConsumer>()); }); configurator.ReceiveEndpoint(host, "MotorRisks", endpointConfigurator => { endpointConfigurator.PrefetchCount = MaxConcurrentThreads; endpointConfigurator.Consumer(() => _container.Resolve<GetMotorQuoteBulkQuoteConsumer>()); }); }); _bus.Start(); _scheduler.JobFactory = new MassTransitJobFactory(_bus); _scheduler.Start(); var schedulerEndpoint = await bus.GetSendEndpoint(new Uri("rabbitmq://localhost/quartz")); await schedulerEndpoint.ScheduleSend(new Uri("rabbitmq://localhost"), DateTime.Now.AddSeconds(60), message);--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/c165620d-60d9-40cc-b8b2-a1ed8a9f2f0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Chris,
var schedulerEndpoint = await bus.GetSendEndpoint(new Uri("rabbitmq://localhost/quartz"));await schedulerEndpoint.ScheduleSend(new Uri("rabbitmq://localhost/HomeRisks"), DateTime.Now.AddSeconds(5), message);--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/da0ae971-a100-4409-9dfc-587c47648b8a%40googlegroups.com.
Superstar added the following
configurator.ReceiveEndpoint(host, "quartz", endpointConfigurator => { configurator.UseMessageScheduler(endpointConfigurator.InputAddress); endpointConfigurator.Consumer(() => new ScheduleMessageConsumer(_scheduler)); endpointConfigurator.Consumer(() => new CancelScheduledMessageConsumer(_scheduler)); });