thenativeweb / node-cqrs-domain

Node-cqrs-domain is a node.js module based on nodeEventStore that. It can be very useful as domain component if you work with (d)ddd, cqrs, eventdenormalizer, host, etc.
http://cqrs.js.org/pages/domain.html
MIT License
269 stars 57 forks source link

Difference between revision and a version? #108

Closed domagojk closed 6 years ago

domagojk commented 6 years ago

Hy! I'm new to CQRS/ES architecture and I'm experimenting with my own implementation in node.

Usually in CQRS examples I saw, the word "version" refers to a number which increments every time an event is stored to ensure optimistic concurrency.

But since in this implementation there is both "version" and "revision", I suppose a "revision" is this number which increments every time an event is saved and a "version" refers to command and event "signature" (so it's incremented only when property is changed/added and similar).

Could you please confirm is my assumption correct or is it used differently?

nanov commented 6 years ago

You got it half right.

The "revision" refers to the aggregate and it is basically a number incremented with each event ( and appended to it ) to control concurrency and the right order of denormalization ( with help from revisonGuardStore if you use adrai/node-cqrs-eventdenormalizer ).

The "version" refers to the command and it allows you to have two versions of the same command, useful in a scenarios when you change the command expected payload ( ie. producing version 2 of the command ), but some components of your system dispatch older versions of the command.

domagojk commented 6 years ago

Understood! :) Thank you.