https://github.com/wickedflame/broadcast
Simple and easy to use background task processing and message queue for .NET
https://github.com/wickedflame/broadcast
background-jobs background-tasks background-worker broadcast recurring-tasks scheduled-tasks
Last synced: 6 months ago
JSON representation
Simple and easy to use background task processing and message queue for .NET
- Host: GitHub
- URL: https://github.com/wickedflame/broadcast
- Owner: WickedFlame
- License: ms-pl
- Created: 2015-01-01T11:52:50.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-02-15T10:09:16.000Z (over 2 years ago)
- Last Synced: 2025-05-21T08:44:21.302Z (about 1 year ago)
- Topics: background-jobs, background-tasks, background-worker, broadcast, recurring-tasks, scheduled-tasks
- Language: C#
- Homepage: https://wickedflame.github.io/Broadcast/
- Size: 2.11 MB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: License.txt
Awesome Lists containing this project
README
# WickedFlame Broadcast
------------------------------
[](https://app.travis-ci.com/github/WickedFlame/Broadcast)
[](https://ci.appveyor.com/project/chriswalpen/broadcast/branch/master)
[](https://ci.appveyor.com/project/chriswalpen/broadcast/branch/dev)
[](https://www.nuget.org/packages/broadcast/)
[](https://www.nuget.org/packages/broadcast/)
[](https://sonarcloud.io/summary/new_code?id=WickedFlame_Broadcast)
[](https://sonarcloud.io/summary/new_code?id=WickedFlame_Broadcast)
[](https://sonarcloud.io/summary/new_code?id=WickedFlame_Broadcast)
[](https://www.codacy.com/gh/WickedFlame/Broadcast/dashboard?utm_source=github.com&utm_medium=referral&utm_content=WickedFlame/Broadcast&utm_campaign=Badge_Grade)
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/](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
```csharp
BackgroundTaskClient.Send(() => Trace.WriteLine("This is a basic task"));
```
Processing a task with a custom Broadcaster instance
```csharp
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
```csharp
BackgroundTaskClient.Schedule(() => Console.WriteLine("test"), TimeSpan.FromMinutes(1));
```
Schedule a task with a custom Broadcaster instance
```csharp
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
```csharp
BackgroundTaskClient.Recurring("recurring", () => service.Recurring(DateTime.Now.ToString("o")), TimeSpan.FromMinutes(15));
```
Add a recurring task to be processed with a custom Broadcaster instance
```csharp
var broadcaster = new Broadcaster();
broadcaster.Recurring("recurring", () => service.Recurring(DateTime.Now.ToString("o")), TimeSpan.FromMinutes(15));
```