-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
In this phase, We want to implement Recurring Tasks of Background Processing. Hangfire is a popular example of this.
How to configure tasks in JSON config files should be like this:
{
"BackgroundTasks": [
{
"Name": "Upcoming Payment Reminder",
"Type": "TS.PaymentGateway.Services.ScheduledPaymentReminderTask",
"Start": "07:00:00", // at 7AM
"Recurring": "1.00:00:00" // everyday
}
]
}And interface:
public interface IRecurringBackgroundTask : IDisposable
{
public Task Process(CancellationToken cancellationToken = default);
public Task Start(CancellationToken cancellationToken = default);
public Task Stop(CancellationToken cancellationToken = default);
}We must create a subclass of .NET built-in Background Service to implement Background Task Management.
Also, we need to log background tasks into a MongoDB repository.
The packages will be as follows:
uBeac.Core.BackgroundTasksuBeac.Core.BackgroundTasks.LogginguBeac.Core.BackgroundTasks.Logging.MongoDB