WickedFlame / Broadcast

Simple and easy to use background task processing and message queue for .NET

Home Page:https://wickedflame.github.io/Broadcast/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WickedFlame Broadcast


Build Status Build status Build status NuGet Version NuGet Version

Quality Gate Status Coverage Lines of Code

Codacy Badge

Simple and easy to use background task processing and message queue for .NET

Broadcast is a simple implementation for processing and scheduling tasks in the background without blocking the main thread.
Broadcast helps implement the Mediator or CQRS (Command- and Queryhandling) patterns easily.

Visit https://wickedflame.github.io/Broadcast/ for the full documentation.

Installation

Broadcast is available as a NuGet package

PM> Install-Package Broadcast

After installation setup the Processingserver in Startup.cs with a dashboard if desired

public void ConfigureServices(IServiceCollection services)
{
	...
	services.AddBroadcast();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ...
	app.UseBroadcastServer();
	app.UseBroadcastDashboard();
}

Usage

Background Task processing

Processing a task in a async queue using the default Broadcaster

BackgroundTaskClient.Send(() => Trace.WriteLine("This is a basic task"));

Processing a task with a custom Broadcaster instance

var broadcaster = new Broadcaster();
broadcaster.Send(() => Trace.WriteLine("This is a basic task"));

Scheduleed Tasks

Schedule a task in a async queue using the default Broadcaster

BackgroundTaskClient.Schedule(() => Console.WriteLine("test"), TimeSpan.FromMinutes(1));

Schedule a task with a custom Broadcaster instance

var broadcaster = new Broadcaster();
broadcaster.Schedule(() => Console.WriteLine("test"), TimeSpan.FromMinutes(1));

Recurring Tasks

Add a recurring task to be processed in a async queue using the default Broadcaster

BackgroundTaskClient.Recurring("recurring", () => service.Recurring(DateTime.Now.ToString("o")), TimeSpan.FromMinutes(15));

Add a recurring task to be processed with a custom Broadcaster instance

var broadcaster = new Broadcaster();
broadcaster.Recurring("recurring", () => service.Recurring(DateTime.Now.ToString("o")), TimeSpan.FromMinutes(15));

About

Simple and easy to use background task processing and message queue for .NET

https://wickedflame.github.io/Broadcast/

License:Microsoft Public License


Languages

Language:C# 86.4%Language:CSS 4.9%Language:JavaScript 3.3%Language:SCSS 2.8%Language:HTML 2.5%Language:ASP.NET 0.0%