All Projects → VahidN → DNTScheduler.Core

VahidN / DNTScheduler.Core

Licence: Apache-2.0 license
DNTScheduler.Core is a lightweight ASP.NET Core's background tasks runner and scheduler

Programming Languages

C#
18002 projects
HTML
75241 projects
Batchfile
5799 projects
CSS
56736 projects

Projects that are alternatives of or similar to DNTScheduler.Core

BlazoredLocalStorage
This library has been moved to the Blazored org
Stars: ✭ 26 (-40.91%)
Mutual labels:  aspnetcore, asp-net-core
AspNetCore.Unobtrusive.Ajax
Unobtrusive Ajax Helpers (like MVC5 Ajax.BeignForm and Ajax.ActionLink) for ASP.NET Core
Stars: ✭ 46 (+4.55%)
Mutual labels:  aspnetcore, asp-net-core
MR.AspNetCore.Jobs
A background processing library for Asp.Net Core.
Stars: ✭ 59 (+34.09%)
Mutual labels:  schedule, aspnetcore
Aspnetcorelocalization
Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
Stars: ✭ 183 (+315.91%)
Mutual labels:  aspnetcore, asp-net-core
Inyector
Library to Implement Automatic dependency injection by Configuration over Scaned Assemblies
Stars: ✭ 13 (-70.45%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcoremultipleproject
ASP.NET Core API EF Core and Swagger
Stars: ✭ 189 (+329.55%)
Mutual labels:  aspnetcore, asp-net-core
Hexagonal-architecture-ASP.NET-Core
App generator API solution template which is built on Hexagnonal Architecture with all essential feature using .NET Core
Stars: ✭ 57 (+29.55%)
Mutual labels:  aspnetcore, asp-net-core
Formhelper
ASP.NET Core - Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)
Stars: ✭ 155 (+252.27%)
Mutual labels:  aspnetcore, asp-net-core
aspnetcore-authentication-apikey
Easy to use and very light weight Microsoft style API Key Authentication Implementation for ASP.NET Core. It can be setup so that it can accept API Key in Header, Authorization Header, QueryParams or HeaderOrQueryParams.
Stars: ✭ 215 (+388.64%)
Mutual labels:  aspnetcore, asp-net-core
Home
Home for Blazor Extensions
Stars: ✭ 51 (+15.91%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcore.identity.mongo
This is a MongoDB provider for the ASP.NET Core 2 Identity framework
Stars: ✭ 179 (+306.82%)
Mutual labels:  aspnetcore, asp-net-core
DNZ.SEOChecker
SEO Checker and Recommander Plugin (like wordpress Yoast) for ASP.NET Core.
Stars: ✭ 18 (-59.09%)
Mutual labels:  aspnetcore, asp-net-core
Netcorecms
NetCoreCMS is a modular theme supported Content Management System developed using ASP.Net Core 2.0 MVC. Which is also usable as web application framework. This project is still under development. Please do not use before it's first release.
Stars: ✭ 165 (+275%)
Mutual labels:  aspnetcore, asp-net-core
Onion Architecture Asp.net Core
WhiteApp API solution template which is built on Onion Architecture with all essential feature using .NET 5!
Stars: ✭ 196 (+345.45%)
Mutual labels:  aspnetcore, asp-net-core
Firewall
ASP.NET Core middleware for IP address filtering.
Stars: ✭ 159 (+261.36%)
Mutual labels:  aspnetcore, asp-net-core
SeoTags
SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data).
Stars: ✭ 113 (+156.82%)
Mutual labels:  aspnetcore, asp-net-core
Recaptcha.aspnetcore
Google reCAPTCHA v2/v3 for .NET Core 3.x
Stars: ✭ 122 (+177.27%)
Mutual labels:  aspnetcore, asp-net-core
Elmahcore
ELMAH for Net.Standard and Net.Core
Stars: ✭ 127 (+188.64%)
Mutual labels:  aspnetcore, asp-net-core
MinimalApi
ASP.NET Core 7.0 - Minimal API Example - Todo API implementation using ASP.NET Core Minimal API, Entity Framework Core, Token authentication, Versioning, Unit Testing, Integration Testing and Open API.
Stars: ✭ 156 (+254.55%)
Mutual labels:  aspnetcore, asp-net-core
PersianDataAnnotations
PersianDataAnnotations is ASP.NET Core MVC & ASP.NET MVC Custom Localization DataAnnotations (Localized MVC Errors) for Persian(Farsi) language - فارسی سازی خطاهای اعتبارسنجی توکار ام.وی.سی. و کور.ام.وی.سی. برای نمایش اعتبار سنجی سمت کلاینت
Stars: ✭ 38 (-13.64%)
Mutual labels:  aspnetcore, asp-net-core

This project has been merged with DNTCommon.Web.Core

DNTScheduler.Core

DNTScheduler.Core is a lightweight ASP.NET Core's background tasks runner and scheduler.

Install via NuGet

To install DNTScheduler, run the following command in the Package Manager Console:

PM> Install-Package DNTScheduler.Core

You can also view the package page on NuGet.

Usage

  • After installing the DNTScheduler.Core package, to define a new task, create a new class that implements the IScheduledTask interface:
namespace DNTScheduler.TestWebApp.ScheduledTasks
{
    public class DoBackupTask : IScheduledTask
    {
        private readonly ILogger<DoBackupTask> _logger;

        public DoBackupTask(ILogger<DoBackupTask> logger)
        {
            _logger = logger;
        }

        public bool IsShuttingDown { get; set; }

        public async Task RunAsync()
        {
            if (this.IsShuttingDown)
            {
                return;
            }

            _logger.LogInformation("Running Do Backup");

            await Task.Delay(TimeSpan.FromMinutes(3));
        }
    }
}

The RunAsync method represents the task's logic.

  • To register this new task, call services.AddDNTScheduler(); method in your Startup class:
namespace DNTScheduler.TestWebApp
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddDirectoryBrowser();

            services.AddDNTScheduler(options =>
            {
                // DNTScheduler needs a ping service to keep it alive.
                // If you don't need it, don't add it!
                options.AddPingTask(siteRootUrl: "https://localhost:5001");

                options.AddScheduledTask<DoBackupTask>(
                    runAt: utcNow =>
                    {
                        var now = utcNow.AddHours(3.5);
                        return now.Day % 3 == 0 && now.Hour == 0 && now.Minute == 1 && now.Second == 1;
                    },
                    order: 2);
            });
        }

AddDNTScheduler method, adds this new task to the list of the defined tasks. Also its first parameter defines the custom logic of the running intervals of this task. It's a callback method that will be called every second and provides the utcNow value. If it returns true, the job will be executed. If you have multiple jobs at the same time, the order parameter's value indicates the order of their execution.

  • Finally to start running the registered tasks, call app.UseDNTScheduler() method in your Startup class:
public void Configure(IApplicationBuilder app)
{
    app.UseDNTScheduler();

Please follow the DNTScheduler.TestWebApp sample for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].