Git Product home page Git Product logo

whatifhmmm's Introduction

WhatIfHmmm

Does this make sense?

On the topic of "One command for several aggregates" on #eventsourcing 18/12/2018, someone who wasn't named Sherlock Holmes said: command handles logic and validation, aggregate handles application of state change to itself based on provided events that depends on how you are storing those events

event store is just a concept

it can be mysql, mongo, key-value

whatever

you just have to pair events with their aggregates

that's all it is to it

We (where i work) really do have valid cases where slower/fewer writes (per partition, per sql-db in this case) would be perfectly tollerable, as long as they where consistent (we are paying the bill for inconsistencies and split-brain).

The code is just a super rough sketch, a conversation-piece: The idea is good ol' UnitOfWork with EF, where only events may alter state of the (UseCase)dbContext.

As events are emitted within the UOW, they are added to an eventstore that is part of the dbContext.

A unique-index (AggregateId + Revision) on the Event-table is used to enforce optimistic offline locking for all aggregates in the transaction-scope.

So if just one of the aggregates in scope has changes in the meantime, the dbContext must be reloaded, and the entire thing can be retried.

It can even do sequences ( Command => event1 -> Policy(event1,dbContext) => event2) ...based on intermediary state (dbContext), the hack is to "allow uncommitted reads" for the transactionscope

whatifhmmm's People

Contributors

julianmay avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.