https://github.com/profjordanov/eventsource
The Event Sourcing pattern is implemented as a service in a manner that adheres strictly to established guidelines and principles.
https://github.com/profjordanov/eventsource
asp-net-core-web-api event-sourcing marten
Last synced: 18 days ago
JSON representation
The Event Sourcing pattern is implemented as a service in a manner that adheres strictly to established guidelines and principles.
- Host: GitHub
- URL: https://github.com/profjordanov/eventsource
- Owner: profjordanov
- License: mit
- Created: 2021-04-27T04:41:21.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-30T14:13:05.000Z (almost 2 years ago)
- Last Synced: 2025-03-03T15:12:21.104Z (7 months ago)
- Topics: asp-net-core-web-api, event-sourcing, marten
- Language: C#
- Homepage:
- Size: 437 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
# Event Sourcing as a Service
[](http://makeapullrequest.com)
[](https://travis-ci.com/profjordanov/EventSource)
[](https://www.codacy.com/gh/profjordanov/EventSource/dashboard?utm_source=github.com&utm_medium=referral&utm_content=profjordanov/EventSource&utm_campaign=Badge_Grade)
[](https://github.com/profjordanov/EventSource/issues)
[](https://github.com/profjordanov/EventSource/blob/main/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.



### 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.

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

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

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).

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

## 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.