PulseSharp.Abstractions 0.2.0-alpha

Prefix Reserved
This is a prerelease version of PulseSharp.Abstractions.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package PulseSharp.Abstractions --version 0.2.0-alpha
                    
NuGet\Install-Package PulseSharp.Abstractions -Version 0.2.0-alpha
                    
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="PulseSharp.Abstractions" Version="0.2.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PulseSharp.Abstractions" Version="0.2.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="PulseSharp.Abstractions" />
                    
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 PulseSharp.Abstractions --version 0.2.0-alpha
                    
#r "nuget: PulseSharp.Abstractions, 0.2.0-alpha"
                    
#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 PulseSharp.Abstractions@0.2.0-alpha
                    
#: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=PulseSharp.Abstractions&version=0.2.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PulseSharp.Abstractions&version=0.2.0-alpha&prerelease
                    
Install as a Cake Tool

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="assets/brand/lockup-on-dark.svg"> <img alt="PulseSharp" src="assets/brand/lockup-on-light.svg" height="72"> </picture> </p>

<p align="center"><strong>Lightweight events and jobs for .NET — from the device to the cloud.</strong></p>


Status: preview (0.2). Events and jobs work with the in-memory store. SQLite, PostgreSQL and sync are coming (see the roadmap). The API may change before 1.0.

What is PulseSharp?

PulseSharp is a small .NET library for durable events and background jobs.

  • Events: something happened (SaleCompleted). PulseSharp saves the event first, then delivers it to every handler, in order, with retries.
  • Jobs: work to do (ImportProducts). PulseSharp saves the job, runs it once, and reports progress. Jobs can be retried and cancelled.

It works the same way in a desktop app, a web app, a worker service or a console app, and on the database you already have.

A quick look

dotnet add package PulseSharp --prerelease
public sealed record SaleCompleted(Guid SaleId, decimal Total);

public sealed record SaleStream(Guid SaleId) : StreamName
{
    public override string Value()
    {
        return $"Sale-{SaleId}";
    }
}

// Setup: choose a store and add handlers. Every event handler has a stable name;
// every job type has exactly one handler.
builder.Services.AddPulseSharp(pulse =>
{
    pulse.UseInMemory();
    pulse.On<SaleCompleted>("print-receipt", async (sale, context, ct) => await PrintReceipt(sale, ct));
    pulse.AddHandler<SaleCompleted, UpdateStock>();
    pulse.OnJob<ExportReport>(async (job, context, ct) =>
    {
        for (var page = 1; page <= 10; page++)
        {
            await ExportPage(job, page, ct);
            await context.Report(page, 10, ct);
        }
    });
});

// Something happened: emit it from anywhere through IPulse
await pulse.Emit(new SaleStream(sale.Id), new SaleCompleted(sale.Id, sale.Total));

// Work to do: run it now, or later, with retries, progress and cancel
var jobId = await pulse.Enqueue(new ExportReport(today));
await pulse.Enqueue(new ExportReport(today), new EnqueueOptions { RunAt = tonight });

// A handler class, created through dependency injection for every event
public sealed class UpdateStock(IStock stock) : IEventHandler<SaleCompleted>
{
    public async Task Handle(SaleCompleted sale, EventContext context, CancellationToken ct)
    {
        await stock.Decrease(sale.SaleId, ct);
    }
}

PulseSharp runs as a hosted service, so it works in any app that uses the .NET Generic Host: web apps, worker services, and desktop apps that build a host.

What you get today

  • Events of one stream reach each handler in order. Different streams and different handlers are independent.
  • A failing handler is retried with a growing delay. After MaxAttempts its stream stops for that handler only, and everything else keeps flowing.
  • Stable names: duplicate handler names or event names stop the app at startup with a clear message.
  • Optimistic concurrency with EmitOptions.ExpectedVersion.
  • Every event gets a time-ordered, globally unique id (UUIDv7) and records the node that emitted it.
  • Several streams in parallel per handler (MaxParallelStreams, default 4), still in order within each stream.
  • IPulseControl: list the cursors of every handler, retry or skip a failed event, or rewind a handler to handle everything again.
  • Handler discovery: pulse.AddHandlersFromAssembly(typeof(Program).Assembly), or explicit AddHandler<TEvent, THandler>() / AddJobHandler<TJob, THandler>() for trimming and Native AOT.
  • Jobs: Enqueue now or later (RunAt), one handler per job type, retries with a growing delay, progress (context.Report), cancel (the handler's token), MaxParallelJobs (default 4), and leases so a job left behind by a stopped app instance runs again. IPulseControl reads, lists, cancels and retries jobs.

See samples/ConsoleSample: a printer runs out of paper, the receipts fail, and IPulseControl retries them; then an end-of-day job reports its progress.

Performance

In-memory store, one machine, BenchmarkDotNet short run (benchmarks/):

Per event Time Allocated
Emit (no handlers) ~0.5 µs 542 B
Emit + deliver to 1 handler ~2.2 µs 1.0 KB
Emit + deliver to 3 handlers ~5.6 µs 1.9 KB
Enqueue + run a job ~21 µs 4.5 KB

Numbers for the SQLite and PostgreSQL stores will follow with those stores.

Why PulseSharp?

  • Lightweight. The contracts package has no dependencies. You add only the packages you use.
  • Any database. In-memory, SQLite and PostgreSQL first. Other stores plug into a small contract.
  • Any app. No ASP.NET Core in the core packages. It works with Native AOT.
  • Device to cloud. Events are saved on the device and keep working offline. They sync to the server when the device is back online.
  • Honest guarantees. Delivery is at-least-once, and every handler sees each stream in order. The docs say exactly what is guaranteed and what is not.

Packages

Package What it adds Status
PulseSharp.Abstractions Contracts for handlers and libraries. No dependencies. Preview
PulseSharp The engine, with an in-memory store built in Preview
PulseSharp.Sqlite SQLite store, for desktop and mobile apps Planned (0.3)
PulseSharp.PostgreSql PostgreSQL store, for servers Planned (0.4)
PulseSharp.Sync Device ↔ cloud sync Planned (0.5)
PulseSharp.Monitor Optional web UI Planned (0.6)

Learn more

License

MIT

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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PulseSharp.Abstractions:

Package Downloads
PulseSharp

PulseSharp: lightweight events and jobs for .NET, from the device to the cloud. The engine, with an in-memory store built in.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.0-alpha 103 10/31/2026
0.7.0-alpha 113 10/24/2026
0.6.0-alpha 94 10/20/2026
0.5.0-alpha 90 10/15/2026
0.4.0-alpha 84 10/13/2026
0.3.0-alpha 69 10/11/2026
0.2.0-alpha 74 10/11/2026
0.1.0-alpha 71 10/11/2026
0.0.1-alpha 75 10/11/2026