Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

Circle

About Circle

.Net Core 3 Manager Background Service.

Introduction

Circle is a .Net Core 3 Manager Background Service, that expose an API to handle it.

You simply need to add AddCircle() in the services collection.

Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    services.AddCircle(options =>
    {
        options.Period = TimeSpan.FromSeconds(5);
        options.UseHandler<Work>();
    });
}

Create a Job

You need to create a new class that inherits from IWorkHandler, and write the task that need to be executed.

public class Work : IWorkHandler
{
    public void DoWork()
    {
        Console.WriteLine("Test!");
    }
}

Control the Job

You can use CircleControl class to start, stop or restart the service.

public class HomeController : Controller
{
  private readonly CircleControl _circle;

  public HomeController(CircleControl circle)
  {
      _circle = circle;
  }

  public IActionResult Stop()
  {
      _circle.Stop();
      return Ok();
  }
}

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.