Skip to content

Implement Background Processing - Recurring Tasks #168

@ilhesam

Description

@ilhesam

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.BackgroundTasks
  • uBeac.Core.BackgroundTasks.Logging
  • uBeac.Core.BackgroundTasks.Logging.MongoDB

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions