Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ProximoSrl/NStore

Opinionated eventsourcing library
https://github.com/ProximoSrl/NStore

ddd dotnetcore eventsourcing

Last synced: about 1 month ago
JSON representation

Opinionated eventsourcing library

Awesome Lists containing this project

README

        

logo

# NStore

## (Yet Another) Opinionated Event Sourcing Library

NStore started as a playground for experimenting with .net Standard, async and a simple API for a Sql/NoSql backed EventStore.

After years of experience running NEventStore in production we wrote NStore from scratch with a simpler and extensible API.

## CI Status

| Build server | Platform | Build Status |
| ------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AppVeyor | Windows | [Build status](https://ci.appveyor.com/project/andreabalducci/nstore) | |
| GH Actions | Linux | [Build status](https://github.com/ProximoSrl/NStore/blob/develop/.github/workflows/ci.yml) |
| Azdo | Windows | [Build status](https://dev.azure.com/gianmariaricci/Public/_build/latest?definitionId=130) |

## Quickstart

Setup the streams factory

```csharp
var streams = new StreamsFactory(new InMemoryPersistence());
```
open the stream
```csharp
var post = streams.Open("post/123");
```
append new data
```csharp
await post.AppendAsync(new Favorited("users/200", DateTime.UtcNow));
```
read the stream
```csharp
await post.ReadAsync(chunk =>
{
Console.WriteLine($"{chunk.PartitionId} #{chunk.Index} => {chunk.Payload}");
return Subscription.Continue;
});
```

Process the stream
```csharp
var favs = await post.AggregateAsync();

Console.WriteLine($"{favs.Count} users added '{post.Id}' as favorite");

```

Full source at [src/NStore.Quickstart/Program.cs](src/NStore.Quickstart/Program.cs)

---

## Learn

The source comes with a [Sample App](https://github.com/ProximoSrl/NStore/tree/develop/src/NStore.Sample) to illustrate some basic stuff you can do.