Skip to content

muscankaraoglu/event-source-and-outbox-pattern

Repository files navigation

Event Sourcing with Outbox Pattern Example

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.

Table of Contents

Introduction

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.

Architecture

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.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/muscankaraoglu/event-source-and-outbox-pattern
    cd event-source-and-outbox-pattern
  2. Restore the dependencies:

    dotnet restore
  3. Build the solution:

    dotnet build

Running the Application

To run the application, use the following command:

dotnet run --project src/Program.cs

About

Testing Event Sourcign and Outbox Pattern.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages