Git Product home page Git Product logo

wickedflame / broadcast Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 2.16 MB

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

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

License: Microsoft Public License

C# 86.38% HTML 2.50% CSS 4.93% SCSS 2.83% JavaScript 3.35% ASP.NET 0.02%
broadcast background-jobs scheduled-tasks background-tasks background-worker recurring-tasks

broadcast's Introduction

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));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.