I have looked around and haven't found a solid, up to date reference on using Quartz (or any comparable job scheduler) with ServiceStack. I would like to do the following:
Does it make sense to use ServiceStack in a Windows service with a scheduler in this way? Is there a better arrangement? If it works, how do I run Quartz in ServiceStack?
I have lots of partial ideas in my head, but need help putting together a cohesive plan, so any help is much appreciated.
You can use the ServiceStack.Quartz kindly made by wwwlicious.
A great job scheduler is Hangfire (Hangfire.io). Personally like it a lot more than Quartz.
It is not as easy injecting Hangfire using existing IoC Funq container that comes with servicestack. But have a look at this question & answer
I'm a bit late to the party here, but I'm in the same situation. I can't think of a good reason why implementing a Quartz Scheduler in a Self Hosted ServiceStack application would be a bad idea.
I quickly made a library that integrates the Quartz Scheduler with the ServiceStack Funq IoC which basically allows you to set up your Quartz with ServiceStack with:
//// This method scans the assembly for the Jobs
container.RegisterQuartzScheduler(typeof(HelloJob));
//// Resolve the Quartz Scheduler as normal
var scheduler = container.Resolve<IScheduler>();
//// Start Quartz Scheduler
scheduler.Start();
You will be able to use the Quartz Scheduler as you would normally.
I've provided an example of how it could be used here: https://github.com/CodeRevver/ServiceStackWithQuartz
NuGet is here: https://www.nuget.org/packages/ServiceStack.Funq.Quartz/
As I said, I did this in a few hours to see if it would fit my purposes. If you want to modify it to do something you want it to do, feel free to modify it.
If you're interested, I'm about to write a Blog post about it here: http://michaelclark.tech/2016/04/16/creating-a-servicestack-windows-service-that-uses-quartz/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With