Skip to content

The .NET SDK for KurrentDB

Kurrent Surge

Append anything. Process everything.

The .NET SDK for KurrentDB. Append across streams, process what arrives, and evolve your events, without writing the machinery around any of it.

  • Many kinds of message per stream, each in its own format
  • A hosted runtime that owns the subscription, the checkpoints and the shutdown
  • No reflection anywhere. Source generators instead

Install

Terminal window
dotnet add package Kurrent.Surge

What it takes

This much. No more.

Declared once

The attribute scans this assembly at compile time. Both programs below reference it and pick the catalog up automatically. Neither declares anything.

BikeShare.Rides/Events.cs
[assembly: MessageCatalog("BikeShare.Rides", AlwaysActive = true)]
namespace BikeShare.Rides;
public record BikeUnlocked(string BikeId, string RiderId);
public record RideStarted(string RiderId, string BikeId);

Produce

One unlock, two streams. Both land, or a bike goes missing.

Producer/Program.cs
var builder = Host.CreateApplicationBuilder(args);
builder.AddKurrentSurge("kurrentdb");
using var host = builder.Build();
var client = host.Services.GetRequiredService<KurrentClient>();
var records = new[] {
AppendRecord.Create(new BikeUnlocked("991", "alice"),
r => r with { Stream = "bike-991" }),
AppendRecord.Create(new RideStarted("alice", "991"),
r => r with { Stream = "rider-alice" })
};
await client.Streams.AppendRecords(records, default);

Consume

A typed handler on the same records. The runtime owns the loop.

Consumer/Program.cs
var builder = Host.CreateApplicationBuilder(args);
builder.AddKurrentSurge("kurrentdb", surge => surge
.AddProcessor<FleetWatch>(opts =>
opts.Subscription.Filter = RecordFilter.ByCategory("bike")));
await builder.Build().RunAsync();
sealed class FleetWatch : MessageProcessor {
public FleetWatch() =>
Process<BikeUnlocked>((ride, ctx) =>
ctx.Logger.LogInformation("Bike {Id} is out", ride.BikeId));
}

No subscription loop, no checkpoint bookkeeping, no reconnect policy. Those are the runtime’s, and it hands them back the moment you ask for them.

What you get

All of this. One package.

KurrentDB stores an ordered log, not a set of queues. Most clients stop at moving bytes across it.

01

Hosted runtime

Processing, already wired

Write the handler. The runtime owns the subscription, the checkpoints and the shutdown, and gives them back on request.

Nothing to wire. Nothing to remember.

Read the guide →
02

Messages

Serialization you never see

Many kinds of message on one stream, each in its own format. Every record carries the schema that decodes it back into a CLR type.

JSON, Protobuf and Avro. Same stream.

See the schema layer →
03

Atomic writes

One append, many streams

Several streams, one transaction, a revision guard on each. Every one lands, or none does.

No saga. No outbox.

Browse the streams API →
04

Connection

Resilience in the core

Retry on every method, and a real gRPC load balancer that ranks nodes from gossip and follows the leader election underneath it.

Your code never finds out.

See how it routes →
05

Record filters

A WHERE clause, not a prefix

Filter by stream, category, schema, an index, or a field inside the message. Bound parameters, one expression.

category = 'player' AND data.fee > 40000000

One predicate. Both halves.

See the filter syntax →
06

Management

Connectors, indexes and nodes, from code

Start a connector. Build a secondary index. Register a schema. Scavenge a node. All from the client you already opened.

No console. No scripts. No curl.

See what it manages →