/EventSource

The Event Sourcing pattern is implemented as a service in a manner that adheres strictly to established guidelines and principles.

Primary LanguageC#MIT LicenseMIT

Event Sourcing as a Service

PRs Welcome Build Status Codacy Badge GitHub issues GitHub license

This project aims to prototype event store via web api.

Brief introduction of the event sourcing pattern

It's about ensuring that all changes made to the application state during the entire lifetime of the application are stored as a sequence of events.

alt text

alt text

alt text

alt text

Event Store on PostgreSQL with Marten

The Marten library provides .NET developers with the ability to easily use PostgreSQL database engine with JSONB support to expose an ACID-compliant event store.

Prerequisites

If you have Docker installed you can just double-click run-app.sh .

Example

Start the app and execute a POST request to the /api/UpcomingEvents/receive endpoint.

alt text

Then with the same 'identifier' value execute a POST request to the /api/UpcomingEvents/flag

alt text

If we now go to the pgAdmin and check the tables in the 'event-store', they should look like:

alt text

In the 'mt_streams' table , there should be only a since record with the provided by us ID and version 2.

In the 'public.mt_events' table, there should be 2 records (for each event that we have registrated).

alt text

In the 'mt_doc_upcomingeventview' table, there should be a single record with the current state of our aggragate.

alt text

Strong Benefit: real time reporting as a service

Example : Transactional use cases (saga pattern)

In summary, modern systems have more and more such cases, where they receive a message via HTTP, AMQP, etc and then several components are responsible to process this message. In this case, they need to track the progress of the message and have a fluent log of what went wrong.