Backynet 0.0.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Backynet --version 0.0.1
                    
NuGet\Install-Package Backynet -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Backynet" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Backynet" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Backynet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Backynet --version 0.0.1
                    
#r "nuget: Backynet, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Backynet@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Backynet&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Backynet&version=0.0.1
                    
Install as a Cake Tool

Backynet

latest version preview version downloads 100 - commitow

Backynet is a library designed for performing background tasks such as sending emails or processing large files. It focuses on high performance, is built around the .NET ecosystem, and utilizes all its latest features.

Every task added to the queue is guaranteed "at least once delivery", so you don't have to worry about data loss. The library's architecture allows for easy addition of new nodes by specifying the same connection string. Because jobs are serialized, they can be executed on any of the available nodes.

Installation

Backynet is available on NuGet. Install the provider package corresponding to your target database or message broker (In development, only PostgreSql is supported).

dotnet add package Backynet.PostgreSql

Basic usage

var optionsBuilder = new BackynetContextOptionsBuilder().UsePostgreSql("<connection-string>");
var defaultBackynetContext = new DefaultBackynetContext(optionsBuilder.Options);

using var cts = new CancellationTokenSource();
await defaultBackynetContext.Server.Start(cts.Token);

await defaultBackynetContext.Client.EnqueueAsync(() => Calculator.Calculate(100, 200));

Console.ReadKey();

public static class Calculator
{
    public static void Calculate(int a, int b)
    {
        Console.WriteLine($"Sum is {a + b}");
    }
}

public class DefaultBackynetContext : BackynetContext
{
    public DefaultBackynetContext(BackynetContextOptions options) : base(options)
    {
    }
}

Check out more examples.

Benchmarks

BenchmarkDotNet v0.13.12, Windows 10 (10.0.19044.4412/21H2/November2021Update)
Intel Core i9-10900K CPU 3.70GHz, 1 CPU, 20 logical and 10 physical cores
.NET SDK 9.0.100-preview.3.24204.13
  [Host]     : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2
  Job-HUDYGN : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2

InvocationCount=1  UnrollFactor=1  WorkerCount=40  
Type Method N Mean Error StdDev Allocated
BackynetBenchmark EnqueueAsync 100 2.863 s 0.0332 s 0.0311 s 680.91 KB
HangfireBenchmark Enqueue 100 23.130 s 0.1433 s 0.1270 s 4244.99 KB
BenchmarkDotNet v0.13.12, Windows 10 (10.0.19044.4412/21H2/November2021Update)
Intel Core i9-10900K CPU 3.70GHz, 1 CPU, 20 logical and 10 physical cores
.NET SDK 9.0.100-preview.3.24204.13
  [Host]     : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2
  Job-PDYXJX : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2

InvocationCount=1  UnrollFactor=1  WorkerCount=40
Type Method N Mean Error StdDev Median Gen0 Gen1 Allocated
BackynetWorkerBenchmark Execute 100 3.728 s 0.2856 s 0.8422 s 3.032 s - - 1.66 MB
HangfireWorkerBenchmark Execute 100 20.693 s 0.2027 s 0.1797 s 20.689 s 1000.0000 1000.0000 15.09 MB
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Backynet:

Package Downloads
Backynet.AspNetCore

Package Description

Backynet.PostgreSql

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.2-alpha 122 5/30/2024
0.0.1 206 5/22/2024 0.0.1 is deprecated because it is no longer maintained.