title: How to get List of all Hangfire Jobs using JobStorage in C#?
body: <p>I am using <code>Hangfire BackgroundJob</code> to create a background job in C# using below code.</p>
  
  <pre><code>var options = new BackgroundJobServerOptions
          {
              ServerName = "Test Server",
              SchedulePollingInterval = TimeSpan.FromSeconds(30),
              Queues = new[] { "critical", "default", "low" },
              Activator = new AutofacJobActivator(container),
          };
          var jobStorage = new MongoStorage("mongodb://localhost:*****", "TestDB", new MongoStorageOptions()
          {
              QueuePollInterval = TimeSpan.FromSeconds(30)                
          });
          var _Server = new BackgroundJobServer(options, jobStorage);
  </code></pre>
  
  <p>It creates Jobserver object and after that, I am creating Schedule, Recurring Jobs as below.</p>
  
  <pre><code>var InitJob = BackgroundJob.Schedule&lt;TestInitializationJob&gt;(job =&gt; job.Execute(), TimeSpan.FromSeconds(5));
          var secondJob = BackgroundJob.ContinueWith&lt;Test_SecondJob&gt;(InitJob, job =&gt; job.Execute());
          BackgroundJob.ContinueWith&lt;Third_Job&gt;(secondJob, job =&gt; job.Execute());
          RecurringJob.AddOrUpdate&lt;RecurringJobInit&gt;("test-recurring-job", job =&gt; job.Execute(), Cron.MinuteInterval(1));
  </code></pre>
  
  <p>After that, I want to delete or stop all Jobs when my application is stop or close. So in OnStop event of my application, I have written below code.</p>
  
  <pre><code>var monitoringApi = JobStorage.Current.GetMonitoringApi();
                      var queues = monitoringApi.Queues();// BUT this is not returning all queues and all jobs
                      foreach (QueueWithTopEnqueuedJobsDto queue in queues)
                      {
                          var jobList  = monitoringApi.EnqueuedJobs(queue.Name, 0, 100);
                          foreach (var item in jobList)
                          {
                              BackgroundJob.Delete(item.Key);
                          }
                      }
  </code></pre>
  
  <p>But, the above code to get all the Jobs and all Queues is not working. It always returning <code>"default"</code> queue and not returning all jobs.</p>
  
  <p>Can anyone have an idea to get all the Jobs using Hangfire <code>JobStorage</code> and Stops those job when Application is stopped?</p>
  
  <p>Any Help would be highly appreciated!</p>
  
  <p>Thanks </p>