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

Documentation of features #118

Closed xander-mbaka closed 6 years ago

xander-mbaka commented 6 years ago

Hi,

Was wondering where I might get some more info on how the following features work, their options and caveats:

  1. AggregateLock - Domain
  2. Deduplication - Domain
  3. RevisionGuard - Saga

Any pointers?

adrai commented 6 years ago
  1. AggregateLock - Domain

    • AggregateLock prevents concurrent update of your aggregate (if you don't have this already solved in the messaging layer)
  2. Deduplication - Domain

    • Checks the command id and ignores commands that had the same command id in the past...
  3. RevisionGuard - Saga + EvenDenormalizer

xander-mbaka commented 6 years ago

Thanks,

Is there an inbuilt way to guard against command payload duplication? To guard from user sending the same cmd payload (e.g from UI double click instead of single click)?

Or I should resort to smth like:

var hash = require('object-hash');

var data = {a: 1, b: 2};

var cmd = new Backbone.CQRS.Command({ id: hash(data), command: 'reverseTransaction', payload: data, }); cmd.emit();

So that the command id is always unique to the payload

adrai commented 6 years ago

No there is nothing inbuilt like that...

adrai commented 6 years ago

I don't know if it's a good idea to have the commad id always unique to the payload...

adrai commented 6 years ago

think of an increment command looking always the same... will be rejected (because of deduplication) but in reality correct.

adrai commented 6 years ago

Try to block the ui action for a couple of seconds or block until the event arrived... like a busy button...

xander-mbaka commented 6 years ago

Much thanks