An application framework to start with EventStoreDb
$ dotnet add package Marty.Net.AggregatesAn extremely opinionated framework to work with Greg Young's EventStoreDb.
Marty.Net is an opinionated application framework for EventStoreDb.
After having been working with EventStore for some time now, and finding different issues on the code using it, starting from the Aggregate down to connection management, Marty.Net was born as an effort to allow me start new projects quickly on top of EventStore.
The motivation behind it is to allow other developers of different levels to use EventStore with the minimum of effort, making simple to configure the behavior, and allow unit testing of simple things (routing, writing and reading).
Also the framework is split in 2 nuget packages to allow easy unit testing without installing all the EventStore dependencies in domain projects.
Marty.Net is not meant to evolve to a heavy bloated library, but to keep things simple and working. Is focused on microservices architecture where DRY is not much of an issue.
Marty.Net main purpose is to allow you to work with EventStore in a few lines, and that's how it will always be.
Marty.Net is intended for developers who want to work with event sourcing and a reliable event store, simplifying their code and life.
It is not designed to deal with every case, but the simple ones, the ones you will be doing 99% of the time.
It enforces the implementation of some interfaces with the aim of having a consistent development experience, so nobody has to worry about the basics of your event store.
Install-Package Marty.Net.Contracts
IEventHandlerIEventsStreamResolver interface to allow the IEventStore know where to append your events.IPipelineBehavior if you want a pipeline behavior for your handlers.IPreProcessor if you to execute actions before your handlers.IPostProcessor if you to execute actions after your handlers.That's it you can start coding, and unit testing... Now you want to see if against a real EventStore instance?
Install-Package Marty.Net
Marty.Net and configure the EventStore with the settings class EventStoreSettings with the only required property ConnectionStringservices.AddMarty.Net(...)SubscribeToStream(...)Append(..)That's it, the simplest way to start event sourcing
Install-Package Marty.Net.Aggreagtes.Contracts
private void Apply(MyEvent1 @event) or private void Apply(MyEvent2 @event)public string StreamForAggregate<T>(System.Guid id) where T : Aggregate var user = await _eventStore.Get<User>(id, cancellationToken);Now when is time to integrate with a real instance of EventStore, just install the package
Marty.Net.Aggregates
and you are ready to go.
A Publisher and Subscriber can be found here You will find how to integrate Pipelines, how to publish events, and how to do simple event sourcing loading aggregates from EventStore.
By default Marty.Net will not retry anything, but there is a mechanism that can be configured or even better replaced with your own retry mechanism. To configure the out of the box retry mechanism, 3 options can be set to retry on subscriptions, reads and write on the settings, the interval en attempts for all: you want something more powerful, like using Polly just implement this interface and that's it.