0

I have jobs that are running correctly, but I need to list these from another application. I'm using Quartz version 3.0.7

I have used the following code:

        var collJobGroups = await pScheduler.GetJobGroupNames();

but it does not return anything. this one either:

        StdSchedulerFactory factory = new StdSchedulerFactory(System.Configuration.ConfigurationManager.AppSettings);
        IScheduler scheduler = await factory.GetScheduler();
        await scheduler.Start();

        IReadOnlyCollection<string> jgn = await scheduler.GetJobGroupNames(new System.Threading.CancellationToken());
user2162990
  • 33
  • 1
  • 7
  • **but I need to list these from another application**, i dont think thats possible. Isn't Quartz register the jobs in memory? – Bagus Tesa Sep 09 '19 at 01:35
  • I am registering from an asp.net MVC app, and it does not list the jobs. – user2162990 Sep 09 '19 at 02:27
  • oh its on web application? then you can create an endpoint to allow another application queries to your app. i believe you can fetch the current registered jobs using the approach explained on [tGet all jobs in Quartz.NET 2.0](https://stackoverflow.com/a/12492279/4648586). if the api isnt changed that is. – Bagus Tesa Sep 09 '19 at 02:29
  • Bagus Tesa , if precisely there I started and nothing returns. and my job runs correctly. – user2162990 Sep 09 '19 at 02:34

1 Answers1

0

If both applications have access to the same database then I recommend that you look at the ADO.NET Job Store instead of RAMJobStore. When you use a database as a Job Store then you can have Scheduler running in one application, and you can read job information through another application. The only problem is that you need to have jobs implemented in a separate class library because you need to have access to classes to create JobDetails.

Matija Sestak
  • 393
  • 1
  • 10
  • msestak, Apparently you mean hangfire, but I use Quartz.NET 3.0. Can you access this database? – user2162990 Sep 11 '19 at 19:04
  • Quartz.NET 3 can also be configured to use database like HangFire. Check http://programmingkeys.blogspot.com/2018/02/quartznet-302-configure-adojobstore.html . So if two apps share same configuration, second app can read jobs and triggers. – Matija Sestak Sep 11 '19 at 19:19