How to implement Quartz in ServiceStack [closed]
Asked Answered
C

3

5

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:

  • Run Quartz or comparable scheduler as a service (to avoid IIS issues)
  • Our project uses ServiceStack, so I would like to use it to have familiar patterns for IoC, etc.

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.

Coop answered 13/11, 2015 at 19:23 Comment(1)
Hey, I'm considering moving my already existing scheduler service into ServiceStack as well. Did you ever try this? How did you get on with it?Fullback
T
3

You can use the ServiceStack.Quartz kindly made by wwwlicious.

Tonie answered 27/4, 2018 at 8:24 Comment(0)
T
2

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

Trustbuster answered 15/11, 2015 at 19:16 Comment(0)
F
2

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/

Fullback answered 17/4, 2016 at 9:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.