Urgent.News

What's breaking now, across thousands of outlets.

Tech

[Event Sourcing] Trying out Sekiban DCB: Introduction

Introduction While researching ways to ensure data consistency using NoSQL in systems with frequent reads and writes, I became interested in Event Sourcing and CQRS. During this process, I found a framework called Sekiban , which is designed for Event Sourcing/CQRS, and decided to try it out. Sekiban - Event Sourcing / CQRS Framework Sekiban is an open-source Event Sourcing and CQRS framework for…

Trying out Sekiban DCB: Introduction

While researching data consistency in NoSQL systems, the author discovered Event Sourcing and CQRS. They found a framework called Sekiban, which they decided to test out. Sekiban is an open-source framework for .NET, utilizing C#, capable of storing events in Azure Cosmos DB, PostgreSQL, or AWS DynamoDB.

Sekiban DCB is an Event Sourcing framework that implements a Dynamic Consistency Boundary (DCB), recording all events in a single global stream. The framework provides three approaches: DCB Native, DCB Wasm, and Sekiban Cloud (still in development).

To get started, the author set up a Windows 11 Pro environment with an ASP.NET development setup. They then installed the Sekiban DCB templates and created a new project using the Decider pattern with the command: "dotnet new sekiban-dcb-decider -n MyApp". Running "dotnet run --project MyApp.AppHost" launched the Aspire dashboard.

The project structure includes: DCBNativeProject.AppHost (managing dependent services), DCBNativeProject.ApiService (API routing and authentication), DCBNativeProject.EventSource (commands, handlers, projectors, and data search processing), and DCBNativeProject.ImmutableModels (defining Student/Class events, tags, state, and deciders).

The author demonstrated creating and retrieving a student record. Creating a student involved handling incoming JSON, converting it to a CreateStudent command, executing the command, generating a StudentCreated event, saving it to the database, and returning the result to the user. Retrieving a student required finding the student using their ID, defining the expected state using a StudentProjector, and calling GetTagStateAsync to restore the current state from past events. The result was then returned to the user.

With the framework handling database saving operations, the author found it convenient to save and load events without worrying about database code. They plan to add more entities and explore different event registrations in future endeavors.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to Understand Why PDF Generation Is Harder Than HTML Rendering in Print Layout

Customer-support teams often discover the PDF problem during a billing spike: the HTML page looks correct in a browser, yet the invoice PDF has a clipped table, a blank second page, or a footer…

  • PDF generation differs from HTML rendering in layout handling and serialization.
  • HTML's dynamic layout adapts to viewports, while PDF has fixed page coordinates.
  • Mismanaged pagination can cause malformed PDF invoices.

More from Wednesday 16 September →