CQRS with Microservices, adding additional microservices

I am working to grok how an entire system built with Event Sourcing, CQRS, and Microservices go together.

first, am I thinking of this correctly?

Let’s say I have a system that keeps track of banking records and the following actions:

CreateAccountCmd --> AccountCreatedEvent I have 2 subscribers to that event. 1) a normalizer service to query, 2)a microservice that sends out a “Welcome” email.

UpdateAccountCommand --> AccountUserNameChangedEvent again, 2 subscribers, 1)the normalizer, 2) another email service.

AccountDepositCommand --> AccountAddedMoneyEvent 1)the normalizer

AccountDepositCommand --> AccountAddedMoneyEvent 1)the normalizer

AccountDepositCommand --> AccountAddedMoneyEvent 1)the normalizer

Now I can query the normalizer for the balance, Is this correct?

I need to put a security feature into place, in which 3 consecutive deposits sends out an alert.

I feel like I should be pulling from Event Store, but how do I “Prime the pump” replaying the events for the new Microservice without sending out the emails all over again?

I might be missing something completely, please don’t hesitate to point me to an article that talks about this type of thing



I should point out, that I was using RabbiMQ as my Queueing and my Microservices are subscribing to it.

For the alert you may want to learn about the concept of Sliding Window in Stream Processing;
Then probably implement it using a Continuous Projection in ES; the projection will emit 1 BadGuyDetected event when it counts 3 deposits; You then have a microservice that reacts on each new BadGuyDetected event and lock the account;

For the balance, I guess you will use the read model : http://williamverdolini.github.io/images/cqrses/CQRS-ES-architecture.png

I guess, what I am really after, is how do I bring a read model service onboard that needs to replay all of the events? If I push them to my message bus, then they would get replayed by everyone. If I were using Event store as my queue I could call a catch up I believe, but I am using RabbitMQ as my Message bus. Do I need to somehow trigger a private stream for replays or new subscriptions?

Using a message bus for read models complicates things a lot. A backchannel to get up to date might the easiest option.


I was kind of thinking that as well, do you know of any posts that describe it more? I am thinking it would be a call to the command service, but something that discusses other folks successes and heartache would be nice

not sure I understand why you use both Rabbit and ES