Is there a job management service that can be run periodically in seconds on asp.net core?

Asked 2 years ago, Updated 2 years ago, 115 views

Currently, I use Hangfire to run background processing regularly.
RecurringJob's periodic execution is at least one minute apart.

RecurringJob.AddOrUpdate(
    ( ) = > Console.WriteLine("Recurring!"),
    Cron.Minuty);

I'd like to move it in seconds (for example, every 10 seconds). Is there a good way?
The rich management console is attractive, so I would like to use Hangfire as it is if possible, but if there is a service that can be used in a similar way, I don't mind.

Thank you for your cooperation.

asp.net

2022-09-30 21:26

2 Answers

Quartz Enterprise Scheduler.NET
https://www.quartz-scheduler.net/

Quartz.NET 3.0 is currently in Alpha version, but it seems that there will be Core compatible and periodic execution in seconds.(I have never tried it.)

A sample tBuild a trigger for a specific moment in time, then repeating every second time times の is helpful.
https://www.quartz-scheduler.net/documentation/quartz-2.x/tutorial/simpletriggers.html

 trigger=TriggerBuilder.Create()
    .WithIdentity("trigger3", "group1")
    .StartAt(myTimeToStartFiring) // if a start time is not given (if this line were selected), "now" is imported
    .WithSimpleSchedule(x=>x
        .WithIntervalInSeconds (10)
        .WithRepeatCount(10)//note that 10 repeats will give a total of 11 fires
    .ForJob(myJob)//identify job with handle to it JobDetail itself                   
    .Build();


2022-09-30 21:26

I'm sorry.Although there is no environment, Hangfire seems to allow NCronTab to specify in seconds.(added support for seconds in NCronTab expressions)

)

If you specify it in six formats, you can specify seconds on the far left, so you might want to do the following:(NCronTab)

RecurringJob.AddOrUpdate(
    ( ) = > Console.WriteLine("Recurring!"),
    "*/10 * * * * *");


2022-09-30 21:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.