Giter Site home page Giter Site logo

fohjin's Introduction

# CQRS, the book

In 2009 I have had the pleasure of spending a 2 day course and many geek beers with Greg Young talking about Domain-Driven Design specifically focussed on Command Query Responsibility Segregation (CQRS).

The example project I created based on these discussions was very well received by the community and regarded a good reference project to explain and learn the patterns that make up CQRS. I decided to add the different blog posts I wrote about the example into a single book so it is easy to find and read.

You can find the book here: https://leanpub.com/cqrs

---

# x86 vs x64

When running the example on a x86 machine you have to go into the /Lib/sqlite/bin/ folder 
and copy the three System.Data.SQLite.* files into the /Lib/sqlite/bin/x64/ folder. This 
is because I am developing on a x64 system. An interesting fact is that the TestDriven.Net
test runner does actually run in x86 mode, so the SQLite reference in the Test project is 
the the x86 SQLite version already. Resharper test runner acts the same.

If you have any questions or other feedback then I would love to hear about it at
[email protected]

-Mark

fohjin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fohjin's Issues

Distributed Services Message Queue

Mark:

Hello, and how are you doing? I hope this message finds you doing well!

I’ve a question for you concerning you’re (awesome!) CQRS implementation…

It has to do with setting up a “Message Queue” for incoming commands from a Client.

image
There are many ideas that suggest that a message queue can be used to publish Commands to the Event Store.

My application demands that a lot of clients will be issuing a lot of commands and a message queue of some kind is a highly recommended strategy for Distributed Services (as I’m sure you’re well aware of… )

The above diagram depicts the current implementation of my Message Queue (using NetMq.ReactiveExtensions); and, I must say: it was dead-easy to do, too.

  1. Web API Controller
    // Create Securities. else if ( secsDto.ActionType.Equals( DbActionType.Create ) ) { var cmd = new CreateSecuritiesCommand( id: Guid.NewGuid() , securitiesReport: secsDto.SecuritiesReport ); var json = JsonConvert.SerializeObject( cmd ); m_Publisher.Publish( json ); await Task.Delay( 1000 ); }

  2. Publisher
    public void Publish( string message ) { // Publish the command on the Message Bus. var cmd = JsonConvert.DeserializeObject<CreateSecuritiesCommand>( message ); var publisher = new PublisherNetMq<string>( m_EndPoint , loggerDelegate: msg => WriteLine( msg ) ); publisher.OnNext( message ); WriteLine( $"Published: {message}" ); }

  3. Subscriber
    public void Subscribe() { subject.Subscribe( ( m ) => { // Valid JSON object. if ( string.IsNullOrEmpty( m ).Equals( false ) ) { var cmd = JsonConvert.DeserializeObject<CreateSecuritiesCommand>( m ); if ( m_Bus != null && cmd != null ) { // Publish on Command Bus. WriteLine( $"Received: {cmd.Id} , {cmd.SecuritiesReport.Id} , {cmd.SecuritiesReport.Ticker}" ); m_Bus.Publish( cmd ); m_Bus.Commit(); } } } ); }

The above is my simple demonstration and really works quite nicely.

I would prefer to use this implementation, as opposed to messing around with your beautifully constructed
Command Registration Action Method:

public Action<TCommand> CreatePublishActionWrappedInTransaction<TCommand, TCommandHandler>( TCommandHandler commandHandler , ref IContainer container ) { var trans = container?.GetInstance<TransactionHandler<TCommand , TCommandHandler>>(); return ( ( c ) => { trans?.Execute( c , commandHandler ); // Move this somewhere else… }); }

… and performing the Publish here…. And then in the Subscriber, actually performing the Commit…. Just seems like I’d have to re-wire a lot of your existing code (which, as I mentioned I don’t want to do because I like the way you’ve done Configuration).

Again, Mark thank you for all you’re wonder work on this project.

Please Advise,

Robert Hyland
President & CEO,
Hyland Computer Systems, L.L.C
E: [email protected]

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.