예제 #1
0
 public bool Requeue([NotNull] string jobId)
 {
     return(BackgroundJob.Requeue(jobId));
 }
예제 #2
0
        static HangFirePageFactory()
        {
            RazorPage.ExceptionHandler = ex => new ErrorPage(ex);

            RegisterDefaultPathHandlerFactory(() => new DashboardPage());

            RegisterPathHandlerFactory(
                "/job/(?<JobId>.+)",
                x => new JobDetailsPage(x.Groups["JobId"].Value));

            RegisterPathHandlerFactory("/queues", x => new QueuesPage());
            RegisterPathHandlerFactory(
                "/queues/fetched/(?<Queue>.+)",
                x => new FetchedJobsPage(x.Groups["Queue"].Value));
            RegisterPathHandlerFactory(
                "/queues/(?<Queue>.+)",
                x => new EnqueuedJobsPage(x.Groups["Queue"].Value));

            RegisterPathHandlerFactory("/enqueued/delete", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Delete(jobId)));

            RegisterPathHandlerFactory("/enqueued/requeue", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Requeue(jobId)));

            RegisterPathHandlerFactory("/processing", x => new ProcessingJobsPage());
            RegisterPathHandlerFactory("/processing/delete", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Delete(jobId, ProcessingState.StateName)));

            RegisterPathHandlerFactory("/processing/requeue", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Requeue(jobId, ProcessingState.StateName)));

            RegisterPathHandlerFactory("/scheduled", x => new ScheduledJobsPage());

            RegisterPathHandlerFactory("/scheduled/enqueue", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Requeue(jobId, ScheduledState.StateName)));

            RegisterPathHandlerFactory("/scheduled/delete", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Delete(jobId, ScheduledState.StateName)));

            RegisterPathHandlerFactory("/servers", x => new ServersPage());
            RegisterPathHandlerFactory("/succeeded", x => new SucceededJobs());
            RegisterPathHandlerFactory("/succeeded/requeue", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Requeue(jobId, SucceededState.StateName)));

            RegisterPathHandlerFactory("/failed", x => new FailedJobsPage());

            RegisterPathHandlerFactory("/failed/requeue", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Requeue(jobId, FailedState.StateName)));

            RegisterPathHandlerFactory("/failed/delete", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Delete(jobId, FailedState.StateName)));

            RegisterPathHandlerFactory("/deleted", x => new DeletedJobsPage());

            RegisterPathHandlerFactory("/deleted/requeue", x => new BatchCommandHandler(
                                           jobId => BackgroundJob.Requeue(jobId, DeletedState.StateName)));

            RegisterPathHandlerFactory(
                "/actions/requeue/(?<JobId>.+)",
                x => new CommandHandler(() => BackgroundJob.Requeue(x.Groups["JobId"].Value)));

            RegisterPathHandlerFactory(
                "/actions/delete/(?<JobId>.+)",
                x => new CommandHandler(() => BackgroundJob.Delete(x.Groups["JobId"].Value)));

            RegisterPathHandlerFactory("/js/scripts.js", x => new JavaScriptHandler());
            RegisterPathHandlerFactory("/css/styles.css", x => new StyleSheetHandler());

            RegisterPathHandlerFactory(
                "/fonts/(?<File>.+)",
                x => new FontsHandler(x.Groups["File"].Value));

            RegisterPathHandlerFactory(
                "/stats",
                x => new JsonStats());
        }