node-cqrs-domain
node-cqrs-domain copied to clipboard
Can a command fire more than one event?
Can a command fire more than one event? Is that supported by the library? I've noticed a missmatch in the revision field when I fire 2 events from the same command, like if one revision is actually skipped.
e.g.: command 'openTask' could fire two events 'taskOpened' and 'urgentTaskOpened' if the task is urgent. If the aggregate 'task' has revision 'n' in this scenario, the 2 events will have revision 'n+2' into the eventstore
Of course it can, it is a pretty common situation, they are all committed in a single commit. The revision, however, is incremented with each single event.
ie. a revision is not skipped, the first event would have revision of previousRevision+1, the next one of previsousRevision+2, and the new state of the aggregate would have the same revision as the last event in the commit. This is the expected behaviour.
We're not having the expected behaviour. Is there something we could missing?
I Really couldn't tell without at least seeing a snippet.
As this behaviour is well tested ( on both eventstore and domain side ), I would guess that there is some kind of misunderstanding of the expected behaviour.