This project demonstrates the implementation of Event Sourcing and the Outbox Pattern in a distributed system using C#. It includes in-memory implementations of repositories and an event bus to facilitate unit testing.
The purpose of this project is to showcase how Event Sourcing and the Outbox Pattern can be implemented together in a C# application. The project includes:
- InMemoryOrderRepository: An in-memory implementation of
IOrderRepository
for storing order aggregates. - InMemoryOutboxRepository: An in-memory implementation of
IOutboxRepository
for storing outbox messages. - InMemoryEventBus: A simple in-memory event bus implementation for publishing and retrieving events.
The project is structured to simulate a real-world distributed system with the following components:
- OrderService: Responsible for handling order-related operations and saving events to the outbox.
- OutboxProcessor: Processes the events stored in the outbox and publishes them to the event bus.
- Repositories: In-memory repositories for storing order aggregates and outbox messages.
- Event Bus: In-memory event bus for simulating event publication and consumption.
-
Clone the repository:
git clone https://github.com/muscankaraoglu/event-source-and-outbox-pattern cd event-source-and-outbox-pattern
-
Restore the dependencies:
dotnet restore
-
Build the solution:
dotnet build
To run the application, use the following command:
dotnet run --project src/Program.cs