Git Product home page Git Product logo

py-simplecqrs's Introduction

Build Status Coverage Status

Simple CQRS application in Python

How it works

   X
  XXX                +------Projection------+
   X     Balance View|    Balance Sheet     |
XXXXXXX  <-----------+"XX1"-------------1400+<-------------+
   X                 |"XX2"-------------2333|              |
   X                 |                      |              |
  XXX                +----------------------+              |
 XX XX                                                     |
XX   XX  +-----------+                                     |
X     X              |Deposit                              |
                     |                                     |
   +                 |                                     |
   |                 |                                     |
   |                 |                                     |
   |                 |                                     |
   |Withdraw         v                                     |
   |                 +------Bus/Handler-----+              |
   |                 |                      |              |
   +---------------->+    Account Handler   |              |New Events
                     |                      |              |
                     +--+----------------+--+              |
                        ^                |                 |
                        |                |                 |
                        |                |                 |
            Event Stream|                |New Events       |
                        |                |                 |
                        |                |                 |
                        |                |                 |
                        |                |                 |
                        |                v                 |
                  +-----+---Event-Store--+-----+           |
                  |AccountCredited "XX1", 1000 |           |
                  |AccountCredited "XX5", 2000 |           |
                  |AccountDebited  "XX1", 300  |           |
                  |AccountCredited "XX1", 100  +-----------+
                  |AccountDebited  "XX1", 200  |
                  |AccountCredited "XX5", 333  |
                  |............................|
                  +----------------------------+

What is included

Event Store

Sample event store saves events into dictionary. Nice features:

  • Saves events
  • Loads event stream
  • Provides events for projection

Event store does not publish events - projections need to poll for new events themselves

Account Handler

Command Handler and Command Bus as one thing for the sake of simplicity. Nice features:

  • Deposits money
  • Withdraws money
Balance Sheet

Projection which downloads new events from Event Store and updates balance documents. Nice features:

  • Provides with balances of all the accounts
  • Checks event store for update per your request

How to use it

Run app with Python 3 to perform example operations with accounts and print balances

py-simplecqrs's People

Contributors

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